In the context of Java's 'Future' interface, what does the 'get()' method do?
It sets a timeout for the asynchronous computation
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 cancels the asynchronous task associated with the Future
Which method is used to add elements to the end of a Queue in Java?
Queue
offer()
add()
insert()
push()
What distinct advantage does a 'Callable' interface offer over 'Runnable' in Java?
Callable is used for tasks that don't return a value, while Runnable is for tasks that do
Callable executes faster than Runnable
Callable can be used with traditional threads, while Runnable requires an ExecutorService
Callable can throw checked exceptions, while Runnable cannot
What does the 'E' typically represent in a generic type parameter like 'List<E>'?
Element
Entry
Enum
Exception
What is the primary benefit of using generics in Java?
Reduced code duplication
Enhanced performance at runtime
Improved code readability
Stronger type checking at compile time
When a subclass provides a specific implementation for a method already defined in its superclass, what is this called?
Dynamic dispatch
Method hiding
Method overloading
Method overriding
What is the primary purpose of using a BufferedInputStream in Java?
BufferedInputStream
To serialize and deserialize objects to and from a byte stream.
To perform asynchronous file operations for faster data processing.
To directly read and write primitive data types to a file.
To improve file I/O performance by reducing the number of interactions with the underlying storage.
Which method is used to forcefully stop the execution of a thread, although considered deprecated due to potential risks?
stop()
destroy()
interrupt()
halt()
Which keyword is used to create a generic method in Java?
typeparam
No specific keyword is required
template
generic
What OOP concept is demonstrated when a single method call behaves differently depending on the object's type?
Polymorphism
Encapsulation
Abstraction
Inheritance