Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?()A.staticB.finalC.constD.abstract

题目
Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?()

A.static

B.final

C.const

D.abstract


相似考题
参考答案和解析
参考答案:B
更多“Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?() A.staticB.finalC.constD.abstract”相关问题
  • 第1题:

    Given:Which statement is true about the class of an object that can reference the variable base? ()

    A.It can be any class.

    B.No class has access to base.

    C.The class must belong to the geometry package.

    D.The class must be a subclass of the class Hypotenuse.


    参考答案:C

  • 第2题:

    ______is the address of.a variable or a variable in which the address of another variable is stored.

    A.Director

    B.Pointer

    C.Array

    D.Record


    正确答案:B
    解析:指针是一个变量的地址或者是存储了另一个变量地址的变量。

  • 第3题:

    package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()

    • A、any class
    • B、only the Target class
    • C、any class in the test package
    • D、any class that extends Target

    正确答案:C

  • 第4题:

    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  

    • A、The value of an int is undetermined.
    • B、The value of all numeric types is zero.
    • C、The compiler may issue an error if the variable is used before it is initialized.
    • D、The value of a String variable is "" (empty string).
    • E、The value of all object variables is null.

    正确答案:B,E

  • 第5题:

    What does it mean for a variable in the Application Editor to be defined as a parameter?()

    • A、The variable can be used to pass data to and from subflows.  
    • B、The value for that variable can be supplied via Application Configuration in Application Administration.  
    • C、The value for that variable is defined by the calling application.  
    • D、The variable can be used in conditional steps.  
    • E、The variable can be used to pass data to and from VoiceXML applications.

    正确答案:B

  • 第6题:

    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() 

    • A、 The declaration on line 2 does not allocate memory space for the variable myVect.
    • B、 The declaration on line 2 allocates memory space for a reference to a Vector object.
    • C、 The statement on line 2 creates an object of class Vector.
    • D、 The statement on line 3 creates an object of class Vector.
    • E、 The statement on line 3 allocates memory space for an object of class Vector.

    正确答案:A,D,E

  • 第7题:

    A class design requires that a member variable cannot be accessible directly outside the class. Which modifier should be used to obtain the access control?()    

    • A、 public
    • B、 no modifier
    • C、 protected
    • D、 private

    正确答案:D

  • 第8题:

    单选题
    package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()
    A

     It can be any class.

    B

     No class has access to base.

    C

     The class must belong to the geometry package.

    D

     The class must be a subclass of the class Hypotenuse.


    正确答案: B
    解析: 暂无解析

  • 第9题:

    多选题
    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()
    A

    The value of an int is undetermined.

    B

    The value of all numeric types is zero.

    C

    The compiler may issue an error if the variable is used before it is initialized.

    D

    The value of a String variable is  (empty string).

    E

    The value of all object variables is null.


    正确答案: B,E
    解析: 暂无解析

  • 第10题:

    多选题
    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()
    A

    The declaration on line 2 does not allocate memory space for the variable myVect.

    B

    The declaration on line 2 allocates memory space for a reference to a Vector object.

    C

    The statement on line 2 creates an object of class Vector.

    D

    The statement on line 3 creates an object of class Vector.

    E

    The statement on line 3 allocates memory space for an object of class Vector.


    正确答案: C,D
    解析: SL-275中指出:要为一个新对象分配空间必须执行new Xxx()调用,new调用执行以下的操作: 
    1.为新对象分配空间并将其成员初始化为0或者null。 
    2.执行类体中的初始化。(例如在类中有一个成员声明int a=10;在第一步后a=0 ,执行到第二步后a=10)    
    3.执行构造函数。 
    4.变量被分配为一个到内存堆中的新对象的引用。

  • 第11题:

    多选题
    A Company.com developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in a thread-safe manner.  Which two can support this design goal?()
    A

    Store the data in a local variable.

    B

    Store the data in an instance variable.

    C

    Store the data in the HttpSession object.

    D

    Store the data in the ServletContext object.

    E

    Store the data in the ServletRequest object.


    正确答案: A,C
    解析: 暂无解析

  • 第12题:

    单选题
    A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()
    A

     public int MAX_LENGTH=100;

    B

     final int MAX_LENGTH=100;

    C

     final public int MAX_LENGTH=100;

    D

     public final int MAX_LENGTH=100;


    正确答案: C
    解析: Java中共有变量使用public定义,常量变量使用final,另外注意的是修饰符的顺序,一个最完整的修饰是public static final int varial_a=100;这个顺序不能错,这和c++中也是 不同的。而答案c恰恰错在修饰符的顺序上。

  • 第13题:

    ______ is the address of a variable or a variable in which the address of another variable is stored.

    A.Director

    B.Pointersystem

    C.Array

    D.Record


    正确答案:B
    解析:译文的含义是:()是一个变量的地址或存储了其他变量地址的变量。A、B、C、D各选项的意思分别是:控制器、指针、数组、记录。很明显,题目描述的是指针,所以应该选择B。

  • 第14题:

    For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippetmust you use to declare this instance variable in the JSP Document?()

    • A、<jsp:declaration>int count = 0;<jsp:declaration>
    • B、<%! int count = 0; %>
    • C、<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>
    • D、<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>

    正确答案:A

  • 第15题:

    A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()   

    • A、 public int MAX_LENGTH=100;
    • B、 final int MAX_LENGTH=100;
    • C、 final public int MAX_LENGTH=100;
    • D、 public final int MAX_LENGTH=100;

    正确答案:D

  • 第16题:

    A member variable defined in a class can be accessed only by the classes in the same package. Which modifier should be used to obtain the access control?()         

    • A、 private
    • B、 no modifier
    • C、 public
    • D、 protected

    正确答案:B

  • 第17题:

    package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()

    • A、 It can be any class.
    • B、 No class has access to base.
    • C、 The class must belong to the geometry package.
    • D、 The class must be a subclass of the class Hypotenuse.

    正确答案:C

  • 第18题:

    A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in athread-safe manner. Which two can support this design goal?()

    • A、Store the data in a local variable.
    • B、Store the data in an instance variable.
    • C、Store the data in the HttpSession object.
    • D、Store the data in the ServletContext object.
    • E、Store the data in the ServletRequest object.

    正确答案:A,E

  • 第19题:

    Which of the following statements about declaration are true?()         

    • A、 Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.
    • B、 Declaration of primitive types such as boolean, byte and so on allocates memory space for the variable.
    • C、 Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.
    • D、 Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object.

    正确答案:A,D

  • 第20题:

    单选题
    A class design requires that a member variable cannot be accessible directly outside the class. Which modifier should be used to obtain the access control?()
    A

     public

    B

     no modifier

    C

     protected

    D

     private


    正确答案: A
    解析: 这个在前面也有叙述,java有四种访问类型,分别为:public,protected,default,private,其中public变量可以被所有的外部类访问,而pretected的可以被同一个包及该类的子类访问,default即没有任何修饰符的变量可以被同一个包中的类访问,而private变量只能在被该类内部被访问。题目中的外部类应该理解为除该类自身的所有其它类,因此只有使用private可以达到要求 

  • 第21题:

    多选题
    Which of the following statements about declaration are true?()
    A

    Declaration of primitive types such as boolean, byte and so on does not allocate memory space for the variable.

    B

    Declaration of primitive types such as boolean, byte and so on allocates memory space for the variable.

    C

    Declaration of nonprimitive types such as String, Vector and so on does not allocate memory space for the object.

    D

    Declaration of nonprimitive types such as String, Vector ans so on allocates memory space for the object.


    正确答案: A,C
    解析: 对原始数据类型的变量的声明将为之分配内存并赋予一个缺省值,参见23题的叙述,而非原始数据类型的变量必须用new Xxxx()分配内存及初始化。但是严格来讲此题的答案有待确定,因为只有原始类型的实例变量和类变量的声明在类对象被创建/类被加载时完成内存的自动分配,而原始类型的局部变量必须显式初始化,从这点来看原始类型的局部变量没有被自动分配内存,SL275中只提出了非原始数据类型的变量必须使用new Xxxx()完成内存的分配而没有指出原始数据类型的变量是否在声明时即自动进行内存分配,而从局部变量不能在显式初始化前使用这点来看在声明时没有进行内存分配。因此答案a的正确性还有待官方的确定。

  • 第22题:

    单选题
    A member variable defined in a class can be accessed only by the classes in the same package. Which modifier should be used to obtain the access control?()
    A

     private

    B

     no modifier

    C

     public

    D

     protected


    正确答案: C
    解析: 一个类中定义的成员变量只能被同一包中的类访问。

  • 第23题:

    单选题
    What does it mean for a variable in the Application Editor to be defined as a parameter?()
    A

    The variable can be used to pass data to and from subflows.  

    B

    The value for that variable can be supplied via Application Configuration in Application Administration.  

    C

    The value for that variable is defined by the calling application.  

    D

    The variable can be used in conditional steps.  

    E

    The variable can be used to pass data to and from VoiceXML applications.


    正确答案: C
    解析: 暂无解析