public class test(   public static void main(stringargs){  

题目
单选题
public class test(   public static void main(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   And command line invocation:  Java Test red green blue  What is the result? ()
A

 Baz has the value of “”

B

 Baz has the value of null

C

 Baz has the value of “red”

D

 Baz has the value of “blue”

E

 Bax has the value of “green”

F

 The program throws an exception.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

下列程序的运行结果是【 】。

public class Test {

public static void main (String args[]) {

String s1="hello!";

System.out.println (s1.toUpperCase());

}}


正确答案:HELLO!
HELLO! 解析:在String类的常用方法中,toUpperCaee()方法将当前字符串中的所有小写字母转化成大写,其他字符保持不变。

第2题:

( 8 )阅读下列代码

public class Test2{

public static void main(String args[]){

System.out.println(5/2);}}

其执行结果是 【 8 】 。


正确答案:

第3题:

下列程序段的输出结果是【 】。

public class Test {

void printValue(int m) {

do {

System.out.println("The value is"+m);

}while (--m>10);

}

public static void main (String args[]) {

int i=10;

Test t= new Test();

t.printValue(i);

}

}


正确答案:Thevalue is 10
Thevalue is 10 解析:本题考查do-while循环的用法。do-while至少执行一次,在执行完do中的内容后,判断while中的条件是否为true。如果为true,就再执行do中的内容,然后再进行判断。依次类推,直到while的判断为false时退出循环,执行循环后面的内容。题目中m的值为10,当程序运行到do-while循环时,程序先执行一次循环然后再作判断,在判断条件--m>10时,其值为false,退出循环。因此只执行了一次输出操作,输出内容为:The value is 10。

第4题:

下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}

A.编译错误

B.0

C.1

D.运行成功,但不输出


正确答案:A
解析:static不能修饰局部变量。

第5题:

已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?()

A.t.f

B.this.n

C.Test.m

D.Test.n


正确答案:AD

第6题:

下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(7/2); } }

A.3.5

B.3

C.3.0

D.3.50


正确答案:B
解析:整数除以整数其结果是舍去小数点后面的数,不进行四舍五入。

第7题:

请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”

Class Test 【 15 】 {

Public static void main (String[] arge){

Test t = new Test();

t.start();

}

Public void run(){

System.out.println( “ Hello! ” );

}


正确答案:

第8题:

下列语句输出结果为( )。public class test{public static void main(String args[]){byte b=OXA;System.out.println(b);}}

A.OXA

B.A

C.1

D.10


正确答案:D

第9题:

下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new Te

A.0

B.1

C.2

D.3


正确答案:C

第10题:

以下程序调试结果为:

public class Test {

int m=5;

public void some(int x) {

m=x;

}

public static void main(String args []) {

new Demo().some(7);

}

}

class Demo extends Test {

int m=8;

public void some(int x) {

super.some(x);

System.out.println(m);

}

}

A.5

B.8

C.7

D.无任何输出

E.编译错误


正确答案:B

更多相关问题