- ACompile with error
- BRuntime Exception
- C5
- D6
The correct option is:
access
Java uses access specifiers (also known as access modifiers) to control the visibility of classes, methods, and fields. These include public
, private
, protected
, and the default (package-private) access level.
The correct option is:
volatile
In Java, the volatile keyword tells the JVM that a variable's value may be modified by multiple threads, ensuring that the most up-to-date value of the variable is always read by the threads.
The correct option is:
cloneable
The Cloneable
interface needs to be implemented in a class to allow objects to be copied (cloned) using the clone()
method in Java.
The correct option is:
collection
Iterators provide a generic way to traverse through all the elements of a collection (such as lists, sets, etc.) regardless of how the elements are organized.
The correct option is:
primitive
Java uses primitive data types (such as int
, char
, boolean
, etc.), which are not objects. This is why Java is not considered a pure object-oriented programming language.
The correct option is:
sub
Overriding occurs when a method in a subclass has the same name and parameters as a method in its superclass, allowing the subclass to provide a specific implementation of that method.
The correct option is:
Ternary Operator
The ternary operator in Java is a conditional operator that takes three operands and is used as a shorthand for an if-else
statement. Its syntax is: condition ? expression1 : expression2
.
The correct option is:
interface
The interface
keyword is used in Java to declare an interface.