What is the difference between an instance variable and a local variable in Java?
Vishalini.R Answered question September 7, 2023
Outside of the method, local variables are hidden from view. Instance variables are declared outside of a method in a class. They are also known as member variables or field variables. Each instance variable value has a slot when an object is allocated on the heap.
Vishalini.R Answered question September 7, 2023