Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
Cipher Configuration on Apache HTTPD 4 53
egit plugin on eclipse 8 41
servlet example issue 6 33
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now