- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java static keyword
The static keyword is used to
- create variables that will exist independently of any instances created for the class. Only one copy of the static variable exists regardless of the number of instances of the class. Static variables are also known as class variables. Local variables cannot be declared static.
- create methods that will exist independently of any instances created for the class. Static methods do not use any instance variables of any object of the class they are defined in. Static methods take all the data from parameters and compute something from those parameters, with no reference to variables. Class variables and methods can be accessed using the class name followed by a dot and the name of the variable or method.
- create block that can be used to initialize static variables or execute static methods once when classloader loads the class.
- Related Articles
- static Keyword in Java
- static Keyword in Java programming
- static keyword in C++ vs Java
- Static Keyword in C++
- static keyword in C#
- Can we use "this" keyword in a static method in java?
- Is it possible to use this keyword in static context in java?
- Does static factory method internally use new keyword to create object in java?
- Can a "this" keyword be used to refer to static members in Java?\n
- The static keyword and its various uses in C++
- Why can't we use the "super" keyword is in a static method in java?
- Golang Program to Show Usage of Static keyword in Class
- Java strictfp keyword
- Java static variable
- Java static method

Advertisements