Thread: Java Help
View Single Post
Old 04-19-07, 10:36 PM   #3
rhink
Registered User
 
Join Date: Jul 2005
Posts: 434
Default Re: Java Help

That's because ivar is 0 in B. new A() and new B() create two different objects.... ivar is only being set in A.

Try:

B b = new B();
b.setIvar(25);
b.setIvar2(35);
b.d1();
rhink is offline   Reply With Quote