New course! Every coder should learn Generative AI!
Try a free lesson0
static members are shared across all instances, and the class can accesd it too.
So:
class Hoomen {
static int numberz = 3;
int aeg;
Hoomen(int i) {
aeg = i;
}
}
class Program {
publuc static void main(String[] args) {
System.out.println(Hoomen.numberz); // 3
Hoomen men = new Hoomen(8);
Hoomen.numberz = 10;
System.out.println(men.numberz); // 10
}
}