You are on page 1of 2

Java question: 1.

what is the output of the below program public class prog { public static void main(String args[]) { char x='x'; int i=0; System.out.println(true?x:0); System.out.println(false?i:x); } } 1.x,0 2.x,120 3.120,0 4.0,x 2.which is not java data type? 1.byte 2.double 3.bool 4.char 3.what are the values of a,i and b? public class test { public static void main(String args[]) { byte a=64,b; int i; i=a<<2; b=(byte)(a<<2); System.out.println(+a+,+i+,+b+); } } 1.64,0,256 2.64,256,0 3,64,0,128 4.64,128,0

4.In java,switch expression must contains the following switch(expression) { case1: case2: } 1.byte,short 2.byte,short,int 3.int,char 4.1 and 3 5. find the output of the below programe public class test { public static void main(String args[]) { int i,j; i=100,j=200; while(++i<--j); System.out.println(i); } } 1.100 2.Run Time Error 3.150 4.Compile Time Error 6.

You might also like