This site requires JavaScript, please enable it in your browser!
Greenfoot back

how do i use a variable (not a method) in a separate class?

Vercility Vercility

2018/3/21

#
public Class1 {

private int xyz = 0;

public int getXYZ() {
return xyz;
}

public Class2 {
Class1 object = new Class1();
int abc = object.getXYZ();
}
You need to login to post a reply.