java - If outer class(enclosing class) and inner class have data member with same names then how can we differentiate them -
if have class following have data members same names in inner , outer class, how can differentiate them? if want calculate sum of inner 2 int a+b, outersum?
public class outerclass { int a; int b; class innerclass{ int a; int b; int innersum = a+b; int outersum = ?; } }
int outersum = outerclass.this.a + outerclass.this.b;
Comments
Post a Comment