What is Local Variable and Instance Variable?

1 answers
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.
shilpigupta22 shilpigupta22 [Author] 6 months ago votes 0