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

Open 1 Answers 24 Views Education

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

1 Answer

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

Using name of the interface.

interface Vehicle {

   static void blowHorn() {

      System.out.println("Blowing horn!!!");

   }

}

class Car implements Vehicle {

   public void print() {

      Vehicle.blowHorn();                  

   }

}
by (53.7k points)
...