Lambda expressions eliminate the need for ________.
- Anonymous inner classes
- Arrays
- Inheritance
- Interfaces
Lambda expressions eliminate the need for anonymous inner classes. Before lambda expressions were introduced in Java, anonymous inner classes were used to implement single-method interfaces, like Runnable or ActionListener. Lambda expressions provide a more concise and expressive way to define such implementations, reducing the verbosity of code.
Loading...
Related Quiz
- The ________ method is used to move the thread into the Ready/Runnable state.
- How can you read an 8-bit byte from a file using byte streams in Java?
- What will be the output of the following code snippet: public int add(int a, long b) { return a + b; } and public long add(int a, int b) { return a + b; }?
- In method overriding, the return type must be the same or a ________ of the superclass overridden method's return type.
- How can you read data from a URL using Java?