Choose the correct statement. Restriction on static methods are: I. They can only call other static methods.
II. They must only access static data.
III. They cannot refer this or super in any way.
A. Only (I)
B. (I) and (II)
C. (II) and (III)
D. Only (III)
E. (I), (II) and (III)
Answer: Option E
Join The Discussion
Comments ( 1 )
Related Questions on Declaration and Access Control
What is the default access modifier for class members in Java if no access modifier is specified?
A. public
B. protected
C. private
D. package-private
A. private
B. public
C. protected
D. package-private
What keyword is used to declare a constant in Java, which is implicitly final and static?
A. final
B. const
C. static
D. constant
A. protected
B. private
C. public
D. default
public class Tester {
int x =48;
void display(){
System.out.println(x);
}
public static void main (String[] args){
Tester obj = new Tester();
System.out.println(obj.x);
obj.display();
}
}