In Java's concurrency model, what is the primary purpose of a 'wait()' call on an object?
To signal other waiting threads to resume execution
To check if the object's lock is available
To forcefully acquire the object's lock
To release the object's lock and put the thread in a waiting state
Which built-in Java annotation is used to indicate that a method overrides a method in its superclass?
@Deprecated
@SuppressWarnings
@FunctionalInterface
@Override
Which interface is used to create a type-safe heterogeneous container in Java?
Iterable
Iterator
Collection
Comparable
What is the primary purpose of using the @Deprecated annotation in Java?
To throw a runtime exception if the method is called
To indicate that a method is no longer recommended for use
To hide methods from documentation
To prevent a method from being inherited
What is the function of the transient keyword in Java serialization?
transient
It specifies a custom method for serializing an object.
It indicates that a field is a constant value.
It marks a class as eligible for serialization.
It prevents a field from being included in the serialized data.
Which keyword is used to declare a class that cannot be instantiated but serves as a blueprint for other classes?
final
static
abstract
interface
Which List implementation in Java uses a dynamic array to store elements and provides fast access to elements by their index?
List
Vector
LinkedList
ArrayList
Stack
How can you get the current year using the java.time API?
java.time
LocalDate.now().getYear()
Calendar.getInstance().get(Calendar.YEAR)
LocalTime.now().getYear()
Year.now()
What does the 'E' typically represent in a generic type parameter like 'List<E>'?
Entry
Exception
Element
Enum
What is the purpose of defining a custom annotation in Java?
To control access modifiers for classes and methods
To define new data types
To create new keywords in the Java language
To attach metadata to classes, methods, or fields