对于下面代码,正确的Java源程序文件名是( )。 class A { void method1() { System.out.println("Method1 in class A"); } } public class B { void method2() { System.out.println("Method2 in class B"); } public static void main(String[] args) { System.out.println("main() inclass B"); } }
举一反三
- 【单选题】对于下面代码,正确的Java源程序文件名是( )。 class A { void method1() { System. out .println( "Method1 in class A" ); } } public class B { void method2() { System. out .println( "Method2 in class B" ); } public sta
- 中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- public class test { public static void main(String args[]) { int m=0; for ( int k=0;k<2;k++) method(m++); System.out.println(m); } public static void method(int m) { System.out.print(m); } }
- 【单选题】下列哪行代码有错误? public class Example{ public static void main(String args[]){ System.out.println("ok"); system.out.println("您好"); } } A. public class Example B. public static void main(String args[]) C. System.out.println("ok"); D. system.out.println("您好");
- 下列ABCD注释标注的哪行代码有错public class Demo { public static void main(String args[]) { System.out.println("Java"); system.out.println("hello"); System.out.println("你好"); } } A: public class Demo B: public static void main(String args[]) C: system.out.println("ok"); D: System.out.println("您好");