Anonymous Asked in Cars &Transportation · 2 weeks ago

What is the difference between local and instance variable?

The main difference between instance variable and local variable is that instance variable is a variable that is declared in a class but outside a method, while a local variable is a variable declared within a method or a constructor. 18 июн. 2019 г.


What are the differences between local static and instance variables?

Instance variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed. Static variables are created when the program starts and destroyed when the program stops.

What is the difference between local variable and global variable?

Global variables are those which are not defined inside any function and have a global scope whereas local variables are those which are defined inside a function and its scope is limited to that function only.

Related Questions

Relevance
Write us your question, the answer will be received in 24 hours