178. Given: 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;
(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;
答案:登入後查看
統計: A(3), B(2), C(2), D(2), E(0) #2720742
統計: A(3), B(2), C(2), D(2), E(0) #2720742