Java Lesson 12 | More on Variables

preview_player
Показать описание
talking about static, final, public, and private
Рекомендации по теме
Комментарии
Автор

A better explanation of static would be that it belongs to a given class, not to an object created from that class. If I run the following code (see next comment) the output is:
I was born!
1
I was born!
2
The static variable, "number" is increased when the constructor is called and both objects that belong to the same class can access it.

lakospeter
welcome to shbcf.ru