单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()A any classB only the Target classC any class in the test packageD any class that extends Target

题目
单选题
Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} 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


相似考题
更多“单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()A any classB only the Target classC any class in the test packageD any class that extends Target”相关问题
  • 第1题:

    下面哪个选项正确示例了传递一个参数给applet? ( )

    A.<applet code=Test.class age=33 width=100 heigh=100>

    B.<param name=age value=33>

    C.<applet code=Test.class name-age value=33 width=100 height=100>

    D.<applet Test 33>


    正确答案:B
    解析:该题考查对APPLET>标记中的属性PARAM的理解。属性PARAM是用来传递参数给applet的,它又有两个属性name和value,前者表示参数的名字,后者表示参数的值。选项A和C显然不对,而选项D忽略了关键字param 选项B的表示是正确的。故本题答案是B。

  • 第2题:

    以target.test.com所在网络上的所有个IP地址为目标,通过秘密SYN扫描方式,探测所有活动主机的命令为()。

    A.nmap -ss -o target.test.com/24

    B.nmap -sU -O target.test.com/24

    C.nmap -sS -O target.test.com/24

    D.nmap -iR -O target.test.com/24


    参考答案:C

  • 第3题:

    Class TestException  1. public class TestException extends Exception {  2. } Class a:  1. public class a {  2.  3. public String sayHello(String name) throws TestException {  4.  5. if(name == null) {  6. throw new TestException();  7. }  8.  9. return “Hello “+ name;  10. }  11.  12. }  A programmer wants to use this code in an application: 45. A a=new A();  46. System.out.println(a.sayHello(”John”));  Which two are true?()

    • A、 Class a will not compile.
    • B、 Line 46 can throw the unchecked exception TestException.
    • C、 Line 45 can throw the unchecked exception TestException.
    • D、 Line 46 will compile if the enclosing method throws a TestException.
    • E、 Line 46 will compile if enclosed in a try block, where TestException is caught.

    正确答案:D,E

  • 第4题:

    class A {  public A() {  System.out.println(“hello from a”);  }  }  class B extends A {  public B () {  System.out.println(“hello from b”);  super();  }  }  public class Test {  public static void main(String args[]) {  A a = new B();  }  }   What is the result when main is executed?()  

    • A、 Compilation fails.
    • B、 hello from a
    • C、 hello from b
    • D、 hello from b hello from a
    • E、 hello from a hello from b

    正确答案:A

  • 第5题:

    when a user clicks a link in the left frame of the Review application, the linked data displays in the frame on the right. What did Kristin to do allow this to happen?()

    • A、entered the name of the target frame in hotspot properties
    • B、entered the name of the target in frameset properties
    • C、entered the position of the target frame in frame properties
    • D、entered the position of target frame in hotspot properties. a name other than location

    正确答案:C

  • 第6题:

    10. public class ClassA {  11. public void methodA() {  12. ClassB classB = new ClassB();  13. classB.getValue();  14. }  15. }  And:  20. class ClassB {  21. public ClassC classC;  22.  23. public String getValue() {  24. return classC.getValue();  25. }  26. }  And:  30. class ClassC {  31. public String value;  32.  33. public String getValue() {  34. value = “ClassB”;  35. return value;  36. }  37. }  Given:  ClassA a = new ClassA();  a.methodA();  What is the result?()

    • A、 Compilation fails.
    • B、 ClassC is displayed.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:D

  • 第7题:

    单选题
    What limitations exist for a SAML Partner Provider ID configured at the Identity Provider?()
    A

    The Provider ID can be any string.

    B

    The Provider ID can only include alphanumeric characters.

    C

    The Provider ID must match the prefix of Target URLs in SSO requests.

    D

    The Provider ID must match the Succinct ID configured at the Service Provider.


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

  • 第8题:

    单选题
    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


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

  • 第9题:

    单选题
    when a user clicks a link in the left frame of the Review application, the linked data displays in the frame on the right. What did Kristin to do allow this to happen?()
    A

    entered the name of the target frame in hotspot properties

    B

    entered the name of the target in frameset properties

    C

    entered the position of the target frame in frame properties

    D

    entered the position of target frame in hotspot properties. a name other than location


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

  • 第10题:

    单选题
    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} 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


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

  • 第11题:

    单选题
    class A {  public A() {  System.out.println(“hello from a”);  }  }  class B extends A {  public B () {  System.out.println(“hello from b”);  super();  }  }  public class Test {  public static void main(String args[]) {  A a = new B();  }  }   What is the result when main is executed?()
    A

     Compilation fails.

    B

     hello from a

    C

     hello from b

    D

     hello from b hello from a

    E

     hello from a hello from b


    正确答案: D
    解析: Call to super must be first statement in constructor. 

  • 第12题:

    单选题
    1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?()
    A

     Line 4 of class Target can be changed to return i++;

    B

     Line 2 of class Target can be changed to private int i = 1;

    C

     Line 3 of class Target can be changed to private int addOne() {

    D

     Line 2 of class Target can be changed to private Integer i = 0;


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

  • 第13题:

    使下列程序正常运行并且输出“Hello!”,横线处应填写的内容是( )。 class Test { public static void main(string[]args){ Test t=new Test; start; } Public void run{ System.out.println("Hello!¨); )

    A.extends Thread

    B.extends Float

    C.extends Iostream

    D.extends Stdio


    正确答案:A
    A。【解析】从后面重写了run方法来看,这是通过继承Thread类,并重写run方法定义线程体,然后创建该子类的对象的方式来创建线程。

  • 第14题:

    1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?() 

    • A、 Line 4 of class Target can be changed to return i++;
    • B、 Line 2 of class Target can be changed to private int i = 1;
    • C、 Line 3 of class Target can be changed to private int addOne() {
    • D、 Line 2 of class Target can be changed to private Integer i = 0;

    正确答案:D

  • 第15题:

    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

  • 第16题:

    What limitations exist for a SAML Partner Provider ID configured at the Identity Provider?()

    • A、The Provider ID can be any string.
    • B、The Provider ID can only include alphanumeric characters.
    • C、The Provider ID must match the prefix of Target URLs in SSO requests.
    • D、The Provider ID must match the Succinct ID configured at the Service Provider.

    正确答案:C

  • 第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题:

    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} 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

  • 第19题:

    单选题
    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
    解析: 暂无解析

  • 第20题:

    单选题
    以target.test.com所在网络上的所有个IP地址为目标,通过秘密SYN扫描方式,探测所有活动主机的命令为()。
    A

    nmap -ss -o target.test.com/24

    B

    nmap -sU -O target.test.com/24

    C

    nmap -sS -O target.test.com/24

    D

    nmap -iR -O target.test.com/24


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

  • 第21题:

    单选题
    Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} 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


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

  • 第22题:

    单选题
    10. public class ClassA {  11. public void methodA() {  12. ClassB classB = new ClassB();  13. classB.getValue();  14. }  15. }  And:  20. class ClassB {  21. public ClassC classC;  22.  23. public String getValue() {  24. return classC.getValue();  25. }  26. }  And:  30. class ClassC {  31. public String value;  32.  33. public String getValue() {  34. value = “ClassB”;  35. return value;  36. }  37. }  Given:  ClassA a = new ClassA();  a.methodA();  What is the result?()
    A

     Compilation fails.

    B

     ClassC is displayed.

    C

     The code runs with no output.

    D

     An exception is thrown at runtime.


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

  • 第23题:

    单选题
    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


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

  • 第24题:

    多选题
    Class TestException  1. public class TestException extends Exception {  2. } Class a:  1. public class a {  2.  3. public String sayHello(String name) throws TestException {  4.  5. if(name == null) {  6. throw new TestException();  7. }  8.  9. return “Hello “+ name;  10. }  11.  12. }  A programmer wants to use this code in an application: 45. A a=new A();  46. System.out.println(a.sayHello(”John”));  Which two are true?()
    A

    Class a will not compile.

    B

    Line 46 can throw the unchecked exception TestException.

    C

    Line 45 can throw the unchecked exception TestException.

    D

    Line 46 will compile if the enclosing method throws a TestException.

    E

    Line 46 will compile if enclosed in a try block, where TestException is caught.


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