Back

Welcome to your Java Practice Test - 2

Decide the output of the following Java code?

class Test { public static void main(String args[]) { byte x = 64; int i; byte y; i = x << 2; y = (byte) (x << 2) System.out.print(i + " " + y); } }

Which of the following is a valid declaration of an object of class Hyd?

Which component is responsible for converting bytecode into machine specific code?

Which of this statement is incorrect?

What would be the output of the following code

class Hyd { public static void main(String args[]) { int x = 9; if (x == 9) { int x = 8; System.out.println(x); } } }

What is true about a break?

What will be the output of the following Java program?

class Test { public static void main(String args[]) { int a = 5; int b = 10; first: { second: { third: { if (a == b >> 1) break second; } System.out.println(a); } System.out.println(b); } } }

What would be the output of the following code snippet if variable a=10?

if(a<=0) { if(a==0) { System.out.println("1 "); } else { System.out.println("2 "); } } System.out.println("3 ");

What will be the output of the following Java program?

class RightShift { public static void main(String args[]) { int x; x = 10; x = x >> 2; System.out.println(x); } }

Which component is used to compile, debug and execute java program?

Enroll For Course !