- ACompile with error
- BRuntime Exception
- C5
- D6
The correct option is:
infinite loop
An infinite loop runs continuously without any condition to terminate. Examples of such loops in Java include while(true)
or for(;;)
. The other loops, like do while
, for
, and while
, typically have conditions that can terminate them.
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:
Encapsulation
Encapsulation is the concept of bundling data (attributes) and methods (functions) that operate on the data into a single unit, known as a class, in object-oriented programming.
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:
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.