curve karve wrote:hey i didnt understand why y=y*2 gives result 3???
why not 4???
thanks...
class Uber {
static int y = 2;
Uber(int y) { this(); y = y * 2; } //difference is here
Uber() { y++; }
}
Because the y in y=y*2 is not the same y that is in y++. Since the method declares Uber(int y), all the interior stuff done to y is to the y variable in the parameter list. Once the method is done, that y is gone, and the y that equals 2 is then incremented, making it 3.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."