In the java.time API, which class represents a specific point in time, such as a timestamp?
java.time
LocalDateTime
LocalTime
Instant
LocalDate
Which type of collection is inherently thread-safe and specifically designed for concurrent access in Java?
ArrayList
TreeMap
ConcurrentHashMap
HashSet
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 attach metadata to classes, methods, or fields
To create new keywords in the Java language
Which interface does Java primarily use to represent a task that can be executed concurrently?
Callable
Iterable
Threadable
Runnable
What does the 'E' typically represent in a generic type parameter like 'List<E>'?
Element
Exception
Enum
Entry
When a subclass provides a specific implementation for a method already defined in its superclass, what is this called?
Method overloading
Dynamic dispatch
Method hiding
Method overriding
What is the time complexity of retrieving an element from a HashSet in Java, assuming the hash function distributes elements evenly?
O(log n)
O(1)
O(n)
O(n log n)
In the context of Java's 'Future' interface, what does the 'get()' method do?
It cancels the asynchronous task associated with the Future
It checks if the asynchronous task has completed or not
It retrieves the result of an asynchronous computation, potentially blocking until it's available
It sets a timeout for the asynchronous computation
What is the primary purpose of using the @Deprecated annotation in Java?
To throw a runtime exception if the method is called
To prevent a method from being inherited
To hide methods from documentation
To indicate that a method is no longer recommended for use
What is a potential drawback of using object serialization in Java?
It can be less efficient than custom data writing mechanisms, especially for large objects.
It does not allow for the serialization of primitive data types.
It requires all serialized objects to implement the Cloneable interface.
Cloneable
It is incompatible with network communication protocols.