Interfaces in Java can have ________ methods from Java 8 onwards.
- Both Abstract and Static Methods
- Non-Static Methods
- Only Abstract Methods
- Only Static Methods
Starting from Java 8, interfaces in Java can have both abstract and static methods. This enhancement allows interfaces to have default method implementations using the 'default' keyword and static utility methods. However, they still cannot have instance variables.
Loading...
Related Quiz
- In the context of multithreading, how can the use of getters and setters introduce thread-safety issues?
- Why does Java not support operator overloading?
- Which of the following classes is used to write characters to a file in Java?
- Consider a scenario where multiple threads are executing tasks, but the main thread needs to wait until all tasks are complete before proceeding. How can this be achieved using Future and ExecutorService?
- When would you prefer byte streams over character streams while performing I/O operations in Java?