Asked by Anand Chekkilla on Sep 27, 2024

A variable whose meaning is confined to an object of a class is called:

A) instance variable
B) local variable
C) global variable
D) none of the above

Instance Variable

A variable defined in a class for which each instantiated object of the class has a separate copy, or instance.

Local Variable

A variable that is declared within a block or method and is only accessible within that block or method.

Global Variable

A variable that is defined in a global scope, making it accessible from any part of the program, beyond just the block or function in which it was declared.

  • Understand the range of variables in Java, encompassing instance, local, and global variables.