6.18 OOP Static and Insane Variable
Hello welcome to this new that will devote to the static keyword in java the keyword static is a ... modifier used to save space in memory. It helps to manage the memory occupied by objects, variables ... and methods. The static keyword ensures that only one instance of a relevant object method or variable is created in ... memory. In the Java programming language more precisely, the static keyword indicates that the member in question ... belongs to himself and not to such an instance. This means that only one instance of this static member ... is created and shared by all instances of the class. The static keyword applies to Blocks ... of code Variables Methods To create a static member i.e. block, variable or method), use the ... static keyword. When a member is declared static, it is possible to access it before creating objects in its class ... and without reference to any object. For example, in the java program below, we access the static method displays() ... without creating an object in the User class. Now let’s talk more specifically about static methods How Static Methods Work ... When a method is declared with the static keyword, then it is a static method. The most common example of a ... static method is the main() method you can use without creating an instance. it is possible to access any static member ... before creating objects of its class, and without reference to any object. It should be noted that the ... declared static methods have several restrictions: A static method cannot use "this" and "super ... " in its body. A static method cannot access non-static variables or class methods.A ... static method cannot be re-defined in a subclass. Thank you for following this short introduction to static keyword a ... the next