File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How To Declare and Include Special Characters.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How To Declare and Include Special Characters.." Watch "How To Declare and Include Special Characters.." New topic

How To Declare and Include Special Characters..

John Ray Allen
Ranch Hand

Joined: Jan 06, 2005
Posts: 50
Can anyone help me how to declare special characters that are frequently used in a program such as ', ", `, (, )...also I want to put those characters inside the System.out.println()..but when I put them inside and enclosed it with quotation mark for example, I want to put the string "), inside the System.out.println()..when I do that I came up with an error..need for your responses..thanks!
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
to put some characters into System.out.println() you have to escape them with a \

Example, if you want to print out:
He said, "Hello"

you would have
System.out.println("He said, \"Hello\"");
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
You can use escape characters to print that characters.
You can read all about that at Java Language Specification - Lexical Structure .

Hope this helps and correct me if I am wrong...

It is sorta covered in the JavaRanch Style Guide.
subject: How To Declare and Include Special Characters..
Similar Threads
Editing Special Character
WSAD specific directions for creating an Oracle Data Source
Character encoding: Foreign characters not displayed correctly in XML and JSP
Sting "\" in my code
HQL + LIKE + _