下列代码中正确的是( )。(选择两项)
A: public String foo() { return “我爱中国”; }
B: public void foo(){
return ”-我爱中国”; }
C: public String foo(){
String s=”我爱中国”; return s; }
D: public int foo(){
String s=“我爱中国”; return s; }
A: public String foo() { return “我爱中国”; }
B: public void foo(){
return ”-我爱中国”; }
C: public String foo(){
String s=”我爱中国”; return s; }
D: public int foo(){
String s=“我爱中国”; return s; }
举一反三
- 读代码:public class foo {static String s;public static void main (String[]args) {System.out.println (“s=” + s);}}结果是
- Which two methods, inserted individually, correctly complete the Three class?() A: public void foo(){ } B: public int foo(){return 3;} C: public Two foo(){return this;} D: public One foo(){return this;} E: public Object foo(){return this;}
- 下面代码的运行结果为:( ) import java.io.*; import java.util.*; public class foo{ public static void main (String[] args){ String s; System.out.println("s=" + s); } }
- Which code, inserted at line 15, allows the class Sprite to compile?() A: Foo{public int bar(){return 1;}} B: new Foo{public int bar(){return 1;}} C: new Foo(){public int bar(){return 1;}} D: new class Foo{public int bar(){return 1;}}
- 阅读以下代码: public class foo{ public static void main (String[] args){ String s; System.out.println("s=" + s); 输出结果应该是