What are the possible scope categories for a Java variable?
Advertisements
प्रश्न
What are the possible scope categories for a Java variable?
लघु उत्तरीय
Advertisements
उत्तर
- Local Variables: These variables are defined within a method, constructor, or block. Their accessibility is limited to that particular method or block.
- Instance Variables: These variables are defined at the class level without the
statickeyword. Each object of the class maintains its own copy of these variables. - Static (Class) Variables: These variables are declared using the
statickeyword within a class. A single copy is shared by all objects of that class.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
