public class MyExample{ public static void main(String args[]) { System.out.println(args[2]) }} 如果以下列命令行运行: java MyExample Aptech online 上述代码将输出()。
第1题:
阅读下列代码段,选出该代码段的正确文件名( )。 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 in class B"); } }
A.A.java
B.A.class
C.B.class
D.B.java
第2题:
阅读下列代码 public class Test{ public static void main(String args[]){ System.out.println(89>>1); } } 其运行结果是
A.44
B.45
C.88
D.90
第3题:
阅读下列代码
Public class Person{
Static int arr[ ] = new int (10);
Public static void main (String args ) {
System.out.println(arr[9]);
}
}
该代码运行的结果是
A )编译时将产生错误
B )编译时正确,运行时将产生错误
C )输出 0
D )输出空
第4题:
下列代码的执行结果是( )。 public class Test{ public static void main (String args[ ]){ System.out.println(5/2): } }
A.2.50
B.2
C.2.5
D.2.0
第5题:
阅读下列代码: public class Person{ static int arr[]=new int[10]; public static void main(String args){ System.out.println{arr[9]); } } 该代码的运行结果是( )。
A.编译时将产生错误
B.编译时正确,运行时将产生错误
C.输出零
D.输出空
第6题:
( 11 )下列程序的功能是统计命令行参数的个数,请在下划线处填上适当的代码。
public class Length{
public static void main(String args[]){
System.out.println( " number of String args: " +args. 【 11 】 );
}
}
第7题:
给定如下Java程序片断: class A{ public A (){ System.out.println("A"); } } class B extends A{ public B(){ System.out.println("B"); } public static void main(String[] args){ B b=new B(); } } 上述程序将()。
第8题:
下列有关main()方法的签名正确的是哪些?()
第9题:
声明Java独立应用程序main()方法时,正确表达是()。
第10题:
class TestMain { static int x = 2; static { x = 4; } static public void main(String[] args) { int y = x + 1; System.out.println(y); } } 和命令行: java TestMain 结果为:()
第11题:
public static void main(String[] args){}
public static void main(String args){}
public void main(String[] args){}
public static int main(String[] args){}
第12题:
“hello”
“good-bye”
“hello”“good-bye”
代码不能编译
第13题:
阅读下列代码 public class Test 2005{ public static void main(String args[]){ System.out.println((3>2)?4:5); } } 其运行结果是
A.2
B.3
C.4
D.5
第14题:
( 8 )阅读下列代码
public class Test2{
public static void main(String args[]){
System.out.println(5/2);}}
其执行结果是 【 8 】 。
第15题:
A.public static void main()
B.public static void main(String[] args)
C.public static int main(String[] args)
D.public void main(String[] args)
第16题:
阅读下面代码 public class Person { static int arr[]=new int[10]; public static void main(String args) { System.out.println(arr[9]); } } 该代码的运行结果是
A.编译时将产生错误
B.编译时正确,运行时将产生错误
C.输出零
D.输出空
第17题:
阅读下面程序 public class Cycle { public static void main(String[] args) { System.out.println(args[0]); } } 在命令行输入java Cycle one two,该程序输出的结果是
A.Cycle
B.one
C.two
D.以上三个选项都不对
第18题:
以下是JAVA中正确的入口方法是? ()
第19题:
Which declarations will allow a class to be started as a standalone program?()
第20题:
作为Java应用程序入口的main方法,其声明格式可以是()。
第21题:
分析下列java代码 Class A{ Public static void main(String[] args){ Method(); } Static void method(){ try{ System.out.println(“hello”) }finally{ System.out.println(“good-bye”); } } } 编译运行后,输出结果是()
第22题:
MyExample
Aptech
Online
产生异常: java.lang.ArrayIndexOutOfBoundsException
第23题:
Hello
good-bye
Hellogod-bye
代码不能编译