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.41Easy

What is the correct way to declare a constant in Java?

Q.42Medium

Which statement about constructor overloading is true?

Q.43Easy

Which of the following is a valid variable declaration?

Q.44Medium

What is the output of: System.out.println(5 % 2 + 3 * 2 - 1);?

Q.45Medium

Which of the following about static variables is incorrect?

Q.46Hard

What is the result of: int x = 5; System.out.println(x++ + ++x);?

Q.47Medium

Which of the following cannot be inherited in Java?

Q.48Easy

What does the 'super' keyword do in Java?

Q.49Medium

Consider: class A { static int x = 5; } How many times is x initialized when you create multiple A objects?

Q.50Hard

Which statement about Java's garbage collection is true?

Q.51Easy

What is the purpose of the 'instanceof' operator?

Q.52Easy

What will be the output of: System.out.println();

Q.53Easy

Consider the code: int x = 5; x += 3; What is the value of x?

Q.54Easy

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

Q.55Medium

What is the scope of a variable declared inside a method in Java?

Q.56Medium

Which of the following will result in a compilation error? class Test { public void method1() { } public void method1(int x) { } }

Q.57Medium

What is the output of: System.out.println(true && false || true);

Q.58Medium

Which statement about method parameters is correct?

Q.59Medium

What is the difference between == and equals() in Java?

Q.60Medium

Consider: String s1 = "Java"; String s2 = new String("Java"); System.out.println(s1 == s2);