Accessing class method inside interface in Java -


public interface counter{     class base1{         protected int count1;         public base1(){             count1=0;         }         @override         public void putcount(){            system.out.println(count1);         }     } } 

how access putcount() in interface's class method , count1 variable?

try this:

counter.base1 mybase1 = new counter.base1(); mybase1.putcount(); 

the concept called inner class, if want find further information. count1 protected, cannot access outside.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -