Highlight the difference between local variable and instance variable

: 176
Paper : Java FAQ (Frequently Asked Questions and answers) for freshers | Platform : Object-oriented programming Language | Category : Programming FAQs

Local Variable is declared inside the methods, constructor, and inside any other blocks. The scope of these variables is only inside the block where they are declared. You can not access these variables outside that particular block.

Instance variables are declared inside the class, but not inside the method. These variables are bounded to its object itself. Each object is creating its individual copy. It won't affect any other variable if we are making changes in one instance.