易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

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;

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • 23.int z=5;  24.  25. public void stuff1(int x) {  26. assert (x> 0);  27. switch(x) {  28. case 2: x= 3;  29. default: assert false; } }  30.  31. private void stuff2(int y) { assert (y 

    A、 All of the assert statements are used appropriately.

    B、 Only the assert statement on line 31 is used appropriately.

    C、 The assert statements on lines 29 and 31 are used appropriately.

    D、 The assert statements on lines 26 and 29 are used appropriately.

    E、 The assert statements on lines 29 and 33 are used appropriately.

    F、 The assert statements on lines 29, 31, and 33 are used appropriately.

    G、 The assert statements on lines 26, 29, and 31 are used appropriately.

  • 33. Date d = new Date(0);  34. String ds = “December 15, 2004”;  35. // insert code here  36. try {  37. d = df.parse(ds);  38. }  39. catch(ParseException e) {  40. System.out.println(”Unable to parse “+ ds);  41. }  42. // insert code here too  Which will create the appropriate DateFormat object and add a day to the Date object?() 

    A、 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setTime( (60 * 60 * 24) +d.getTime());

    B、 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setTime( (1000 * 60 * 60 * 24) + d.getTime());

    C、 35. DateFormat df= DateFormat.getDateFormat(); 42. d.setLocalTime( (1000*60*60*24) + d.getLocalTime());

    D、 35. DateFormat df= DateFormat.getDateJnstance(); 42. d.setLocalTime( (60 * 60 * 24) + d.getLocalTime());

  • 数字签名功能不包括(42)。

    A.防止发送方的抵赖行为

    B.发送方身份确认

    C.接收方身份确认

    D.保证数据的完整性

  • import java.awt.*;   public class Test extends Frame {   public Test() {   add(new Label(“Hello”) );   add(new TextField(“Hello”) );   add(new Button(“Hello”) );   pack();   show();    }   public static void main(String args) {   new Test ();   }   }   What is the result? () 

    A、 The code will not compile.

    B、 A Window will appear containing only a Button.

    C、 An IllegalArgumentException is thrown at line 6.

    D、 A Window button will appear but will not contain the Label, TextField, or Button.

    E、 A Window will appear containing a Label at the top, a TextField below the Label, and a Button  below the TextField.

    F、 A Window will appear containing a Label on the left, a TextField to the right of the Label, and a button to the right of the TextField.

  • public class SyncTest {  private int x;   private int y;   public synchronized void setX (int i) (x=1;)   public synchronized void setY (int i) (y=1;)   public synchronized void setXY(int 1)(set X(i); setY(i);)   public synchronized Boolean check() (return x !=y;)   }   Under which conditions will check () return true when called from a different class? 

    A、 Check() can never return true.

    B、 Check() can return true when setXY is called by multiple threads.

    C、 Check() can return true when multiple threads call setX and setY separately.

    D、 Check() can only return true if SyncTest is changed to allow x and y to be set separately.

联系客服 会员中心
TOP