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

android - Pass an Serializable object in AIDL -

php - Improving script execution time -

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