Qus:-What is meant by Local variable and Instance variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

Qus:-What is meant by Local variable and Instance variable?

19th May 2019, 9:46 AM
Deepika Mourya
Deepika Mourya - avatar
2 Answers
+ 5
Instance variables and class variables are declared inside the class. Local variables are declared inside the method.
19th May 2019, 10:37 AM
Vaishnavi Rajkumar Pawar
+ 4
The variable defined inside method, constructer or block is called local variable. The variable declared and initialized within the method and it will be destroyed when method has completed. And the instence variable are declared inside a class but outside any method . These variable are instantiated when the class is loaded..
19th May 2019, 1:54 PM
Vijendra Mewada
Vijendra Mewada - avatar