Java static Keyword Part 1
Hello friends, when we enter programming, basic syntax are very important. Programmers make lot of errors due to less knowledge about basic syntax. So, let's talk about static keyword in Java. It is used for memory management in java. Let's understand it using a simple example. Example 1 * There is a company called "ABC Ltd". Some employees work in that company. Employee is a main entity. So, attributes will be Employee ID, Name and company. When we design a system for above company, we make the class "Employee" which consists of variables for Employee ID, Name, and company. We know that the company is same in each and every object. So, setting the company for every object is memory-consuming. But we can declare the company as a static variable to make it efficient. Then that field will get memory at once. If it is a non-static member, all company attributes will get memory each time when objects are created. Let's consider another example. Example ...