Solved

How to print pi or half sign or symbol in java ?

Posted on 2001-08-29
4
717 Views
Last Modified: 2008-03-17
Dear Friends,
              I am creating an application in which i want to print some symbols or special character through input and output streams.Please help...

Thanks
0
Comment
Question by:sgupta2000
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
kotan earned 50 total points
ID: 6435729
You should use unicode character set,
Every unicode prefix by \u

For example:

\u00bd  is half sign
\u001c  is pi.

All the code can find in
http://www.pccl.demon.co.uk/java/unicode.html

To print unicode char in file,

java.io.FileWriter fw = new java.io.FileWriter("filename");
fw.write("\u00a2");
fw.close();
0
 

Expert Comment

by:skyjamz
ID: 6435730
beside printing special character, could u tell me how to print an ordinary character :) . thank u.

regards,
sky.
0
 
LVL 6

Expert Comment

by:kotan
ID: 6435766
fw.write("abc\u00a2def");

This will print out abc"half sign"def

abc is ordinary character.

Is it what you want skyjamz
0
 

Expert Comment

by:skyjamz
ID: 6439661
thanx,
sky
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question