CANNOT USE THIS IN STATIC CONTEXT.
public static int getNofStudents(){
return this.NOfStudents;
}
CANNOT USE THIS IN STATIC CONTEXT.
public static int getNofStudents(){
return this.NOfStudents;
}
No you cannot access instance variables inside a static method
but in video t is given.
Either you should pass the object reference to the static method and access instance variables using it, or you can indirectly access instance variables from a static method by passing the instance variable as a paramter to the static method using another instance method(which can obviously access the instance variables directly).