I think I'm misunderstanding something, and if so, I need help..
Let's say I have the following two classes:
public abstract class Abstraction() {
protected int number = 0;
public void printNumber() {
System.out.println(this.number);
System.out.println(getNumber());
}
public int getNumber() {
return this.number();
}
}
public class Reality extends Abstraction {
int number = 1;
public Reality() {
this.printNumber();
}
}
// some other class
new Reality();
What should the output be? I'm getting 0, 0 (the code here is a bit more complicated but still the same issue). How can I get the output to be 1,1?