Tanatep Pichetvasin

Greenhorn
+ Follow
since Aug 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tanatep Pichetvasin

Ilja, Thank you your answer
15 years ago
Thank for your explaination
But why doesn't Java override the attribute ? Why override for only method ?
15 years ago
From the below code, the class B is the subclass of class A. After the instance a is created, the method go is called. Java run this method of the class B. And the value of the attribute x is changed within the method go.
Then I display the value of the attribute x of a. The initial value of x in class A is shown. My question is why doesn't Java show the lastest value of x after the method go finish ?



output >>
B.go() : x = 600
x = 10
----------------------------
B.go() : x = 600
x = 600

[edit]Add code tags. CR[/edit]
[ August 27, 2008: Message edited by: Campbell Ritchie ]
15 years ago