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

What will be the output of the following code?
java
List<String> list = new ArrayList<String>();
list.add("Java");
Object obj = list;
System.out.println(list.getClass() == obj.getClass());

Q.22Easy

Which of the following correctly declares a generic method that returns the first element of any collection?

Q.23Easy

Which declaration is valid in Java Generics?

Q.24Easy

In a Spring Boot application, you need to create a generic repository interface that works with any entity type. Which declaration correctly implements this pattern?

Q.25Easy

When using bounded type parameters with multiple interfaces, what is the correct syntax in Java?