below is a small program which i've lifted from a book (
Java 2: The Complete reference, by H. Schildt).
The output generated form the program is as follows:-
ob1.a: 2
ob2.a: 12
ob2.a after second increase: 22
:roll:
But i have some queries regarding this.
In the line
Test ob1 = new Test(2);
If you follow this, surely the first line of the output should be 12, and not 2, i.e., ob1.a: 12
Just how exactly is this program working??
Sory for asking such an obvious question, but i'm racking my brains over this.
Cheers in advance