WHAT ARE LOCAL AND INSTANCE VARIABLES IN JAVA ?

Devesh Kumar Singh

Total Post:12

Points:60
Posted by  Devesh Kumar Singh
Java 
 557  View(s)
Ratings:
Rate this:
  1. Devesh Kumar Singh

    Post:12

    Points:60
    What are local and instance variables in Java ?

    Local variables are those which are declared within a block of code like methods. Local variables should be initialized before accessing them, whereas

    Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!