Solved

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

Posted on 2001-08-29
4
722 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 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