In this article we will look at static keyword which can be used to share data among multiple objects. static Keyword In Java programs, static keyword can be used to create the following: Class variables Class methods Static blocks Class Variables: The static keyword is used to create one of the three types of variables called as class variables. A class variable is a variable declared inside a class and outside all the methods and is marked as static. Syntax for declaring a class variable or a static variable is shown below: static data-type variable-name; Example for declaring a class
The post What is static keyword in java appeared first on Coding Security.
What is static keyword in java
read more
Tidak ada komentar:
Posting Komentar