Monday, 6 November 2017

java important input output problems



Question 01
What is the output of the following:
System.out.println("1" + 1);
System.out.println('1' + 1);
System.out.println("1" + 1 + 1);
System.out.println("1" + (1 + 1));
System.out.println('1' + 1 + 1);
Output
Output is 11
                  50
                   111
                    12
                   51


Question 02
What is the output of the following:
System.out.println("1" + 1+3);
System.out.println('1' + 1*3);
System.out.println("1" + 1 *4+4+ 1);
System.out.println("1" + 4+(1 + 1));
System.out.println('1' + (1+3) + 1);
 }
Output
Output is
113
52
1441
142
54

No comments:

Post a Comment