Wednesday 30 August 2017

Can we define variables in interface in Java?

In Java , interface doesn't allow you to declare any instance variables. Using a variable declared in an interface as an instance variable will return a compile time error. You can declare a constant variable, using static final which is different from an instance variable.

No comments:

Post a Comment