JAVA variable and Types of Java Variable: Local, Instance and Static

Veröffentlicht am: 17 November 2018
auf dem Kanal: Java Ashram
48
6

A variable is a container which holds the value. A variable is assigned with a data type

*Local Variable:
A variable declared inside the body of the method is called local variable. You can use this variable only within that method and the other methods in the class aren't even aware that the variable exists in the other part of program.
*Instance Variable:
A variable declared inside the class but outside the body of the method, is called instance variable. It is called instance variable because its value is instance/objects specific and is not shared among objects/instances.
*Static variable:
A variable which is declared as static is called static variable. It cannot be local. You can create a single copy of static variable and share among all the instances of the class. Memory allocation for static variable happens only once when the class is loaded in the memory.


Auf dieser Seite können Sie das Online-Video JAVA variable and Types of Java Variable: Local, Instance and Static mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Java Ashram 17 November 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 48 Mal angesehen und es wurde von 6 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!