GeeCON Prague 2014*
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


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How To Declare and Include Special Characters.." Watch "How To Declare and Include Special Characters.." New topic
Author

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
Hi,
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...

thanks
daniel
 
GeeCON Prague 2014
 
subject: How To Declare and Include Special Characters..