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);
Advertisement
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?