Introduction to Variables in Java | Java Tutorial For Beginners #9

Publié le: 06 juin 2021
sur la chaîne: Sumit S Videos
84
7

Introduction to Variables in Java | Java Tutorial For Beginners #9


Variables in Java :
-----------------------------
Variables are used to store the values.
Variable is name of reserved area allocated in memory.
Ex: int roll = 40 ;
here, roll is a variable.

There are three types of variables in java :
------------------------------------------------------------------
1) Instance variable
2) Local variable
3) Static/Class variable


1) Instance variable: Variable declared inside the class but outside methods, constructor or block.
It will be created at the time of object creation.
Access modifiers can be used with instance variables.
Initialization is not mandatory. It has default value provided by JVM.
It will be stored in the Heap memory as the part of object.

2) Local variable : Local variable is declared inside a method, constructor or block.
It will be created while executing the method in which it is declared.
Initialization is mandatory. No default value for local variable.
Access modifiers cannot be used for local variables. Only final keyword can
be used.
Local variable are visible only within the method.
Local variable will be stored inside stack memory

3) Static variable : Variable declared with static keyword are called static variables.
Local variable can not be declared as static.
No need of object creation to call a static variable.
It will be created at the time of class loading.
Scope of static variable is same as the scope of class.

Calling of static variable :
---------------------------------------
Directly possible
By using class name possible
By using object reference name


Learn Core Java From Scratch

Don’t Forget To Like, Comment, Share & Subscribe !!
Keep Learning ! 😊


Important Playlist:

🆓 Software Installation For Developer :    • Software Installation for Developer  

🆓 JDBC Complete Tutorial :    • JDBC Tutorial(Java Database Connectivity)  

🆓 Core Java Tutorial :    • Core Java Tutorials For Beginners  


********************************| Thanks |****************************

#variables #corejava #sumitsvideos #sumitsingh

Related Searches :
local, instance and static variables in java
variables in java
types of variable in java
core java tutorial


Sur cette page du site, vous pouvez voir la vidéo en ligne Introduction to Variables in Java | Java Tutorial For Beginners #9 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Sumit S Videos 06 juin 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 84 fois et il a aimé 7 téléspectateurs. Bon visionnage!