Static fields and methods are connected to the class itself and not its instances. If you have a class A
, a 'normal' method b
, and a static method c
, and you make an instance a
of your class A
, the calls to A.c()
and a.b()
are valid. Method c()
has no idea which instance is connected, so it cannot use non-static fields.
The solution for you is that you either make your fields static or your methods non-static. You main could look like this then:
class Programm {
public static void main(String[] args) {
Programm programm = new Programm();
programm.start();
}
public void start() {
// can now access non-static fields
}
}