I'm new in Java and help me please
public class Student {
static int status = 10;
}
Student person = new Student(5, 78);
System.out.println(person.status);// why static props is work here ?
Emample 2
Student person = new Student(5, 78);
Student person2 = new Student(15, 10);
person.status = 66;
System.out.println(Student.status);
System.out.println(person.status);
System.out.println(person2.status); // WOW !
System.out.println(Student.status); // WOW !
I expected Unexpected error here . Exception! Why in java static fields works for object ?