Thread: Java Help
View Single Post
Old 04-19-07, 01:06 PM   #2
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Java Help

OK, so maybe I need to be more specific....

class A {
int ivar;

int getIvar() {
return ivar; }

void setIvar(int i) {
ivar = i; }
}
class B extends class A {
int ivar2;

int getIvar2() {
return ivar2; }

void setIvar2(int i2) {
ivar2 = i2;}

void d1() {
System.out.println(ivar + ", " + ivar2);
}
}

public class TestDrive {
public static void main(String[] args) {
A a = new A;
B b = new B;

a.setIvar(25);
b.setIvar2(35);

b.d1();
}
}

This is still a simplified version but again the display in class b puts out ivar as 0
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote