0

I am coding through interfaces and i need to access a static method defined in the implementation of interface.

At the java class where i am coding, i have access to the interface class and not the actual implementation class.

I need to access a static method defined in the actual implementation class.

How would i even access it? I dont want to have duplicate logic by creating this static method again at the java class that i want.

Hope the question is clear now

Barry
  • 1,585
  • 3
  • 22
  • 35

1 Answers1

0

Interfaces can have static methods since Java 8. Syntax is the same as with classes. If it makes sense, you could move your static method from your implementation to your interface.

atamanroman
  • 11,607
  • 7
  • 57
  • 81