public class A { public void draw(){System.out.println(“NO?”)}};} class B extends A { public void draw(){ System.out.println(“YES!”)};} A a=new B(); a.draw(); 输出结果是__________,最后两条语句程序体现了java的__________性质。
第1题
A.No568
B.568No
C.No514
D.86No5
第2题
A.Inconceivable!
B.Dizzyingintellect!
C.Thecoderunswithnooutput.
D.Anexceptionisthrownatruntime.
E.Compilationfailsbecauseofanerrorinline22.
第3题
[说明]
本程序接收输入的学生信息,包括学号、姓名、成绩,原样输出信息并计算学生的平均成绩。其中学生类Stud除了包括no(学号)、name(姓名)和grade(成绩)数据成员外,还有两个静态变量 sum和num,分别存放总分和人数,另有一个构造函数、一个普通成员函数disp()和一个静态成员函数avg()用于计算平均分。
[Java代码]
public class Stud {
public int no;
public String name;
public double grade;
public (1) double sum=0;
public static int num=0;
public Stud(int no,String name,double grade) {
this.no = no;
this.name = name;
this.grade = grade;
this.sum=(2);
(3);
}
public static double avg(){
return (4);
}
public void disp(){
System.out.println(this.no+"\t"+this.name+"\t"+this.grade);
}
public static void main(String[] args) {
Stud []students = {new Stud (1,"Li", 81), new Stud(2,"Zhao",84.5), new Stud(3,"Zhang", 87)};
System.out.pfintln("no\tname\tgrade");
students[0].disp();
students[1].disp();
students[2].disp();
System.out.println("avg="+(5));
}
}
第4题
A.<
B. =
C.<=
D.>=
第5题
A.<
B.=
C.<=
D.>=
第6题
A.<
B.=
C.<=
D.>=
第7题
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填人适当的语句。
public class printNo3and5{
void print()
{
int n ;
for(n=100 ;n<=300 ;n++){
if(n%3==0)
__________
System.out.println(n);
}
}
public static__________main(String args[])
{
printNo3and5 bj=new printN03and5();
__________
}
}
第8题
A.<
B.=
C.<=
D.>=
第9题
A.<
B.=
C.<=
D.>=
第10题
A.x=1
B.x=3
C.Compilation&ensp;fails.
D.The&ensp;code&ensp;runs&ensp;with&ensp;no&ensp;output.&ensp;
E.An&ensp;exception&ensp;is&ensp;thrown&ensp;at&ensp;runtime.
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!