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

Which statement about constructors is INCORRECT?

Q.42Medium

Which of the following correctly represents variable declaration and initialization in Java?

Q.43Medium

Which of the following will compile and run without errors?

Q.44Medium

Which method is called automatically when an object is garbage collected?

Q.45Medium

What will be the output of the following code?
String str1 = "Hello";
String str2 = new String("Hello");
System.out.println(str1 == str2);

Q.46Medium

Consider a scenario where you need to create a variable that can hold references to objects of any type. Which of the following approaches would be most appropriate in Java 2024 standards?

Q.47Medium

Which of the following correctly demonstrates method overloading in Java?

Q.48Medium

Consider a real-world scenario where you need to implement a logging system. Which access modifier would you use for internal helper methods that should not be accessible outside the class?

Q.49Medium

Which of the following statements about Java's String class is TRUE?

Q.50Medium

In Java, what is the relationship between an interface and a class in terms of implementation?