Automation lec 16 - Types Of Variable - 2 By Shashank Sir

  Рет қаралды 9

dishaa Institute of Technology.

dishaa Institute of Technology.

Күн бұрын

Types of variable:
1. local variable
Creating variable inside method/block is known as local variable.
Scope of local variable remains only within the method & they are temporary.
2. global variable
Creating variable outside method/block is known as global variable.
Scope of global variable remains throught the class & they are permanent.
3. class/static variable
Declaring the variable using static keyword is known as class/static variable because to access to static variable class name is used.
We can declare static variable only globally.
To access static variable from diff class we need to make use of below statement:
classname.variablename;
int o=Static_variable2.a;
static int a=11;
//globally declare
// use= main method, static, non static method
4. Instance/non-static variable
All the non-static variables are known as instance variable because to access non-static variable instance(object) need to be created.
We can use non static variable in non static method only if we want to use this variable in other class then we have to create object for that
To access non-static variable we need to make use of below statement:
-Create object of class.
-objectname.variablename
Non_static_variable o2=new Non_static_variable();
int b=o2.a;
int a=10;

Пікірлер
Automation Lecture 35 on Collection part -3 By Shashank Sir
50:15
dishaa Institute of Technology.
Рет қаралды 18
Automation lecture -22 on Interface part 2 By Shashank Sir
40:16
dishaa Institute of Technology.
Рет қаралды 14
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,4 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Automation Lecture -23 on Polymorphism In Java By Shashank Sir
33:46
dishaa Institute of Technology.
Рет қаралды 13
Automation Lecture -32 on Array in Java By Shashank Sir
44:02
dishaa Institute of Technology.
Рет қаралды 9
Automation Lecture-26 on Generalization & Abstraction in Java By Shashank Sir
43:37
dishaa Institute of Technology.
Рет қаралды 9
Quiet Night: Deep Sleep Music with Black Screen - Fall Asleep with Ambient Music
3:05:46
Pre-Algebra Final Exam Review
1:56:08
The Organic Chemistry Tutor
Рет қаралды 339 М.
Intro to Java Programming - Course for Absolute Beginners
3:48:25
freeCodeCamp.org
Рет қаралды 3,7 МЛН