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
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
