in Education by

How will you call a default method of an interface in a class in Java8?

1 Answer

0 votes
by
How will you call a default method of an interface in a class in Java8? Using super keyword along with interface name. interface Vehicle { default void print() { System.out.println("I am a vehicle!"); } } class Car implements Vehicle { public void print() { Vehicle.super.print(); } }

Related questions

0 votes
    How will you call a static method of an interface in a class in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the default function call method in C?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    What is the purpose of UnaryOperator functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToLongFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToLongBiFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToIntFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToIntBiFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToDoubleFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ToDoubleBiFunction functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of Supplier functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of Predicate functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ObjLongConsumer functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ObjIntConsumer functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of ObjDoubleConsumer functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
0 votes
    What is the purpose of LongUnaryOperator functional interface in Java8?...
asked Nov 8, 2020 in Education by Editorial Staff
...