What is the output of this program?
class Literal22
{
public static void main(String[] args)
{
char c1='\n';
char c2='\t';
System.out.println(c1);
System.out.println(c2);
}
}
/*
Output:- new line printed nothing output
Explanation:- Every escape character Java is valid char literal.
There are 8 escape characters[\n,\t,\r,\b,\f,\',\",\\] in Java.
*/
{
public static void main(String[] args)
{
char c1='\n';
char c2='\t';
System.out.println(c1);
System.out.println(c2);
}
}
/*
Output:- new line printed nothing output
Explanation:- Every escape character Java is valid char literal.
There are 8 escape characters[\n,\t,\r,\b,\f,\',\",\\] in Java.
*/
0 comments: