题目内容

假设您的方法不返回任何值,那么下列哪个关键字可以用作返回值类型?

A. void
B. int
C. double
D. Public
E. 以上都不是

查看答案
更多问题

以下代码的空白处应填写__________。publicclassTest{publicstaticvoidmain(String[]args){System.out.print("Thegradeis"+getGrade(78.5));System.out.print("\nThegradeis"+getGrade(59.5));}publicstatic_________getGrade(doublescore){if(score>=90.0)return'A';elseif(score>=80.0)return'B';elseif(score>=70.0)return'C';elseif(score>=60.0)return'D';elsereturn'F';}}

A. int
B. double
C. boolean
D. char
E. void

以下代码的空白处应填写__________。publicclassTest{publicstaticvoidmain(String[]args){System.out.println(f(5));}publicstaticintf(intnumber){________________}}

A. return"number";
B. System.out.println(number);
C. System.out.println("number");
D. returnnumber;

以下程序的输出是___________?publicclassTest{publicstaticvoidmain(String[]args){CountmyCount=newCount();inttimes=0;for(inti=0;i<100;i++)increment(myCount,times);System.out.println("myCount.count="+myCount.count);System.out.println("times="+times);}publicstaticvoidincrement(Countc,inttimes){c.count++;times++;}}classCount{intcount;Count(intc){count=c;}Count(){count=1;}}

A. a.myCount.count=101times=0
B. b.myCount.count=100times=99
C. c.myCount.count=99times=98
D. d.myCount.count=0times=101

每个类都有一个默认构造方法。

A. 对
B. 错

答案查题题库