设有类定义如下: class InOut{ String s= new String("Between"); public void amethod(final int iArgs){ int iam=5; iam++; class Bicycle{ public void sayHello(){ //Here } } } public void another(){ int iOther; } } 以下哪些语句可以安排在//Here处 ?
举一反三
- 如下Java代码段,体现了()概念。 public void aMethod(String s){...} public void aMethod(int i){...} public void aMethod(int i,float f){...}
- (1+X)以下哪个不是 “public static void aMethod(){...}” 的重载方法( )? A: public static void aMethod(int num ) ; B: public static int aMethod() ; C: public static void aMethod(int num ,String name) ; D: public static void aMethod(String name) ;
- 从下面四段代码中选择出正确的代码段() 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; }}
- 从下面四段(A,B,C,D)代码中选择出正确的代码段 A: abstract class Name { private String name; public abstract boolean isStupidName(String name) {} } B: public class Something { void doSomething () { private String s = ""; int l = s.length(); } } C: 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; } D: public class Something { public int addOne(final int x) { return ++x; } }
- public class TestDemo{ private int x = 2; static int y = 3; public void method(){ final int i=100; int j = 10; class Cinner{ public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?() A: x B: y C: i D: j