I have 2 classes. In one class i have 4 variables. I instantiate another class and use methods which use these variables. I dont want to pass them as parameters. They are set to public. Both classes are in the default package with each other. heres my code:
public class c1 {
public int x, y, x1, y1;
public static void main(String args[]) {
c1 a = new c1();
}
public c1() {
c2 b = new c2();
b.getSlope();
}
}
public class c2 {
public c2() {}
public int getSlope() {
return (y-y1)/(x-x1);
}
}
i get an error which says: cannot find symbol