The scope of a private instance field is: 私有实例字段的范围是:
A: the instance methods of the same class 同一个类的实例方法
B: inside the class, but not inside any method 在类中,但不在任何方法中
C: inside the parentheses of a method header 方法头的括号内
D: the method in which they are defined 定义它们的方法
A: the instance methods of the same class 同一个类的实例方法
B: inside the class, but not inside any method 在类中,但不在任何方法中
C: inside the parentheses of a method header 方法头的括号内
D: the method in which they are defined 定义它们的方法
举一反三
- Which of the following is false? ( ) A: A static method must be used to access private static instance variables. B: A static method can be accessed even when no objects of its class have been instantiated. C: A static method has no this reference. D: A static method can call instance methods directly.
- 在下面的类中,合法重载的方法是( ) public class Q1{ public void method(int i){} } A: private void method(int i){} B: public void method(int k){} C: public int method(int i){} D: private float method(float f){}
- An object is an instance of a A: program B: class C: method D: data
- 为Demo类的一个无参数无返回值的方法method书写方法头,使用类名Demo作为前缀就可以调用method方法,该方法的方法头为( )。 A: public void method( ) B: static void method( ) C: final void method( ) D: abstract void method( )
- 任何方法(method)都必须放在类中,即放在类后的一对花括号内。