Which variables have the longest scope?
-
Block variables
-
Instance variables
-
Static variables
-
Local variables
C
Correct answer
Explanation
Static variables (class variables) are created when the class is loaded and persist until the program ends - they have the longest scope. Instance variables exist only as long as the object exists. Local (method) variables exist only during method execution. Block variables have the narrowest scope, existing only within their code block.