public ______ HelloWorld { public static void main(String[] args) { System.out.println("Hello World !")______ }}
举一反三
- 程序Helloworld.java编译错误。( )public class HelloWorld { public static void main(String[] args){ system.out.println("Hello World!"); } }
- 给定如下java 代码,在下划线处填入( ),代表HelloWorld 类具有main方法,可以独立运行。public class Helloworld { _______{ System.out.println( “ hello world” ) ; } } A: public static void main( String args ) B: static void main( String args[ ] ) C: public static void main( String[ ] strs ) D: public static main( String args[ ] )
- 下列代码执行结果是?( ) class HelloWorld { public static void modifyString(final String str) { str = "Hello World!"; } public static void main(String[] args) { String a = new String("Hello Java"); modifyString(a); System.out.println(“a = ” + a); } } A: a = Hello Java B: a = Hello World C: 代码编译错误 D: 运行时异常
- public class Example { public static void main(String[] args) { new Father () { public void show() { System.out.println("helloworld"); } }.show(); } } class Father { public void show() { System.out.println("hellofather"); } }
- 下列程序运行结果是( ) public class Demo { public static void main(String[] args) { Object obj=new Father(){ public void show(){ System.out.println("helloworld"); } }; obj.show(); } } class Father{ public void show(){ System.out.println("hello father"); } }