iGET

Java Programming - MCQ Practice Questions

Java interviews and campus tests lean heavily on object oriented behaviour rather than API recall. This set covers inheritance and polymorphism, interfaces and abstract classes, the collections framework, exception handling, multithreading, string handling, and JVM basics such as garbage collection. Output based questions are included because they expose the gaps that theory questions hide.

951 questions | 100% Free

Q.21Easy

Which of the following is a valid method name in Java?

Q.22Easy

Which keyword is used to create a constant variable in Java that cannot be modified after initialization?

Q.23Easy

What will be the result of: int a = 10; int b = 20; System.out.println(a + b + "Java");?

Q.24Easy

Consider the following code: int x = 5; x += 3; System.out.println(x); What is the output?

Q.25Easy

What is the size of 'long' data type in Java?

Q.26Easy

What is the output of: System.out.println();?

Q.27Easy

Which of the following is true about the 'break' statement?

Q.28Easy

Which of the following is NOT a Java keyword?

Q.29Easy

What is the output of: System.out.println(5 > 3 ? "Yes" : "No");?

Q.30Easy

Consider the following code snippet. What is the primary purpose of the 'final' keyword when applied to a class in Java?

Q.31Easy

Which of the following statements about Java's garbage collection is TRUE?

Q.32Easy

What will happen when you execute the following code?
int[] arr = new int[5];
System.out.println(arr[5]);

Q.33Easy

Consider the following code. What will be printed?
String s = "Java";
s = s.concat(" Programming");
System.out.println(s.length());

Q.34Easy

Which of the following is a valid declaration of a two-dimensional array in Java that can store 3 rows and 4 columns of integers?