Nov 21, 2011

Print special symbols like " , / , \ . ..

Hi Every ody ,

I some case we have to print some special symbols like ' , " , / , like

that case simply add (forward slash ) \ before printing special symbol

Example :
-----------
here i want to print below message :

Hello " tutorials-Android " by sravan

then use
String str="Hello \" tutorials-Android \" by sravan";

Program :
-----------


public class Demo {
public static void main(String[] args) {
//String str="Hello\"hai\" wat dng";
String str="Hello \" tutorials-Android \" by sravan";
System.out.println(str);

}

}


out Put :
--------

Hello " tutorials-Android " by sravan

No comments:

Post a Comment