Using the super keyword along with the interface name.
Example:-
interface Vehicle {
default void print() {
System.out.println("I am a vehicle!");
}
}
class Car implements Vehicle {
public void print() {
Vehicle.super.print();
}
}
A Static Method is a Utility method or Helper method, which is associated with a class (or interface). It is not associated with any object.
We need Static Methods because of the following reasons:
public interface Vehicle {
String getBrand();
String speedUp();
String slowDown();
default String turnAlarmOn() {
return "Turning the vehice alarm on.";
}
default String turnAlarmOff() {
return "Turning the vehicle alarm off.";
}
}
Collection API:-
Stream API:-
Stream does not store elements. It simply conveys elements from a source such as a data structure, an array, or an I/O channel, through a pipeline of computational operations.
Stream<String> stream = Stream.empty(); stream.forEach(System.out::println);
ContainingClass::staticMethodName
containingObject::instanceMethodName
ContainingType::methodName
ClassName::new