What is Local Variable and Instance Variable?


Local variable Instance variable
Local variable is declared inside a method or constructor. It can be declared within a block Instance variable is declared inside a class.
Local variable need to be initialized before use. The code will not compile.
Instance variable initialization is not necessary. If not initialized, default value is used.
0 answers