Sunday 23 October 2016

interface variables

interface variables

  • Interface variables are by default public static final, we can say these are constants.
  • At the time of declaration we should perform initialization.
  • We can access directly these variables by interface name.
Syntax
                interface NameOfTheInterface
                { 
                      It can contains variables, abstract methods; 
                }
Example
                interface BankService
                { 
                      int balance = 500; // by default this variable is public static final
                      public abstract int deposite(float money);
                }

Thanks for your time.
Nireekshan