can use variable , methods of interface without using keyword 'implements'.
note:interface , classes in same package.
thanks in advance..!!!
- all variables of interface
public static finaldefault, can directly use them you can implement interface means of anonymous class (without using
implementskeyword)public static void main(string[] args) throws exception{ system.out.println(i.s); // accessing interface i's variable i = new i() { @override public int gets() { return 10; } }; system.out.println(i.gets()); // accessing i's method } interface { string s = "test"; int gets(); }
Comments
Post a Comment