Java Topic

Java Basics Quiz (21 - 40)

Question 1: Which keyword is used to create a constant variable in Java?

Question 2: What is the output of: System.out.println(5 / 2);

Question 3: Which of these is a valid method declaration?

Question 4: What does JRE stand for?

Question 5: Which operator is used for object comparison by reference?

Question 6: What is the purpose of an abstract class?

Question 7: Which keyword is used to implement an interface?

Question 8: What is method overloading?

Question 9: Which concept is demonstrated when a Child class method overrides a Parent class method?

Question 10: What is the default access modifier for interface methods?

Question 11: What is the output of: String str = null; System.out.println(str.length());

Question 12: How do you initialize an array of integers with values 1,2,3?

Question 13: Which String method compares strings ignoring case?

Question 14: What is the index of the first element in an array?

Question 15: Which block must be accompanied by either catch or finally?

Question 16: What is the parent class of all exceptions?

Question 17: Which exception occurs when dividing by zero?

Question 18: Which collection does NOT allow duplicate elements?

Question 19: What is the purpose of generics in Java?

Question 20: Which interface provides the compare() method for sorting?

Comments (0)

No comments yet. Be the first to comment!

LecturreAI Assistant

Hello! I'm LecturreAI

What would you like to learn today?