Reputation: 133
package practice;
public abstract class OutterClass {
public int getMaxRows() {
}
public abstract boolean gameOver();
}
public class InnerClass extends OutterClass{
@Override
public boolean gameOver() {
//int lastRow = getMaxRows() - 1;
//int lastRow = this.getMaxRows() - 1;
//int lastRow = ((OutterClass)this).getMaxRows() - 1;
//int lastRow = ((InnerClass)this).getMaxRows() - 1;
//int lastRow = InnerClass.this.getMaxRows() - 1;
}
What is the difference between all of the commented out code in the sublass (InnerClass)?
Upvotes: 1
Views: 50
Reputation: 310883
// int lastRow = getMaxRows() - 1;
// int lastRow = this.getMaxRows() - 1;
// int lastRow = ((OutterClass)this).getMaxRows() - 1;
// int lastRow = ((InnerClass)this).getMaxRows() - 1;
These are all identical in effect. The last is especially pointless.
// int lastRow = InnerClass.this.getMaxRows() - 1;
This won't compile.
NB Contrary to your nomenclature, there are no inner classes here.
Upvotes: 1