Explain why a static method cannot refer to an instance variable.
What will be an ideal response?
A static method is invoked through a class rather than through an object of the class. No object of the class needs to be instantiated in order to invoke a static method. If no object is instantiated, no instance variable exists. Hence, a static method cannot refer to an instance variable.
Computer Science & Information Technology
You might also like to view...
An I/O request is called a(n) ____ wait in multiprogramming environments.
A. forced B. natural C. scheduled D. indirect
Computer Science & Information Technology
The body of a loop can contain only a limited number of statements.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology