Back

Welcome to your Java Practice Test - 2

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); } } }

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 component is responsible for converting bytecode into machine specific code?

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 ");

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

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 is true about a break?

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

Which of this statement is incorrect?

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); } }

Enroll For Course !