Hi J'pros,
i'd dbt in Inner class, i was taking one mock exam, the question abt inner class abt the scope of variables..which are the variables can be placed in place XX, my answer is ID and nn but to my surprise name is also in the answer list.. when i went thru RHE it says if a inner class is defined inside a method of a outer class only variables accessible is if it's marked as FINAL then how name is accessible.
Any explanation is highly appreciated.
public class Outer{
private static final int ID = 5;
private
String name ;
public voic methodA(final int nn){
int serialIN = 22;
class Inner{
void showresult(){ //Here the parantesis is other way like this way }first of it's printing mistake..
System.out.println("Rslt="+XX);
}
}
new.inner.showresult();
}
}