I'm doing my assignment, and have run into some errors. In one class I have this method:
public class Class1{
public static boolean winningRecord(){
final int WINNING_RECORD;
return Class2.getPoints() > WINNING_RECORD;
}
}
class Class2{
int wins = 0;
public int getPoints(){
return wins; //More to it but to keep it simple I'll leave that out
}
}
Now I'm getting the error "Non-Static method cannot be referenced from a static context...", so I made getPoints() a static method, made the variables static as well, and it works. But in another method for printing out Objects it doesn't work (I believe it's because of the static keyword).
So my question after all this is there a way to call a method without creating an instance of the second Class? This is the general idea code that I have, it should give you an understanding of what is going on, if not I'll add more to it.