hi all:
See this code:
class Process {
byte b=127;
Process() {
this.methodA();
}
void methodA() {
System.out.println("Value of b is = " +b );
}
public static void main(
String [] args) {
Processor p = new Processor();
}
}
class Processor extends Process {
byte b=126;
Processor() {
System.out.println("Value of b* = " + b);
}
void methodA() {
System.out.println("Value of b** = " + this.b);
}
}
The output is :
Value of b**= 0 //(1)
Value of b*= 126
I was confused why line (1) is 0 rather than 126?
Please help me.Thanks!