Anonymous Inner Class in Java not working. Why? -


the class in question this. can see, it's simple. learn workings of anonymous inner classes. in case getting 4 errors saying symbols waterlevel , chlorinelevel cannot found. can see wrong this?

public class pool {     public waterlevel level() {         return new waterlevel() {             private string level = "empty";             public string litrestofull() { return "3000"; }         };     }      public chlorinelevel chlorine(final int amt){         return new chlorinelevel() {             private int level = amt;             int addchlorine() { level += amt; return level; }         };     } } 

rohit jain said

true, anonymous inner classes subclass of waterlevel , chlorinelevel respectively. you've have classes.

this lead me realize have define interface each anonymous inner class i'm using. wanted post it's obvious solved.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -