How to use Runnable interface

java.lang.Runnable is a functional interface that takes no arguments and returns nothing. It is defined as shown below. It is…

add comment

try-with-resources in Java

For Java 11 Certification Exam Practice Questions, refer http://talks.skilltoz.com/java-11-certification-exam-questions/ In this article, let us discuss the support for try-with-resources statement…

add comment

Stream.collect

<to be done>

add comment

Enum in Java – Practice Questions

Enum is a special data type that allows a variable to be one of a set of predefined values. Java…

add comment

Java 8 Default Methods – With this code compile?

interface Vehicle { default void drive() { System.out.println(“Driving a vehicle”); } } class Car implements Vehicle { void drive() {…

add comment

Functional Interfaces in Java 8 – Will this code compile?

@FunctionalInterface interface Champion { default public void declare() { System.out.println(“I am the champion”); } } Ans: No, this code does…

add comment

Which of the following is true about functional interfaces?

a. It should have at least one abstract method b. It should have at least one default method c. It…

add comment

Will the below code compile? Why?

interface Champion { default public void declare() { System.out.println(“I am the champion”); } } interface Winner { default public void…

add comment

Can you override a default method?

Yes. If the same default method is in two interfaces and a class is implementing both interfaces, it has to…

add comment