• 2022-05-31
    从下面四段代码中选择出正确的代码段()
    A: public class Something {public static void main(String[] args) {Other o = new Other();new Something().addOne(o);}public void addOne(final Other o) {o.i++;}}class Other {public int i;}
    B: public class Something {void doSomething () {private String s = ̶”;int l = s.length();}}
    C: abstract class Name {private String name;public abstract boolean isStupidName(String name) {}}
    D: public class Something {public int addOne(final int x) {return ++x; }}
  • 举一反三