Can you overload a method in Java by changing only the return type?
No
Yes
Which operator is used for string concatenation in Java?
/
Which of the following is a characteristic of unchecked exceptions in Java?
They are derived directly from the 'Error' class.
They are not required to be declared in a method's 'throws' clause.
The compiler requires you to handle them explicitly.
They typically represent recoverable situations.
Which of these is a valid way to call a method named 'calculateArea' in Java?
calculateArea()
Area.calculate()
calculateArea;
call calculateArea()
Which access modifier allows a subclass in a different package to access a member of its superclass?
default
public
protected
private
Can a class have multiple constructors?
Yes, but they must have the same parameter list.
No, a class can only have one constructor.
Constructors are optional, so a class may or may not have any.
Yes, as long as they have different parameter lists.
What is the primary difference between an array and an ArrayList in Java?
Arrays can store objects of different classes, while ArrayLists can only store objects of the same class.
Arrays can store primitive data types, while ArrayLists cannot.
Arrays are part of the Java Collections Framework, while ArrayLists are not.
Arrays are fixed in size, while ArrayLists are dynamically sized.
What is the default access modifier for a class member in Java if none is specified?
default (package-private)
Why would you create a custom exception class in Java?
To modify the behavior of existing Java exception classes.
To avoid handling exceptions altogether.
To represent specific exception scenarios relevant to your application.
To improve the performance of exception handling.
What is the role of methods in a Java class?
To define the blueprint for creating objects
To perform actions or operations on an object's data
To store data associated with an object
To control the visibility of class members