The static variable gets memory only once in the class area at the time of class loading.The static variable can be used to refer to the common property of all objects (which is not unique for each object), for example, the company name of employees, college name of students, etc.If you declare any variable as static, it is known as a static variable. Variable (also known as a class variable).The static keyword belongs to the class than an instance of the class. We can apply static keyword with variables, methods, blocks and nested classes. The static keyword in Java is used for memory management mainly. Can we execute a program without main method?.Program of the counter with static variable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |