答:运行结果为:别来无恙? 节日快乐! 一路顺风! 顺风!
很高兴见到您! Null 14、class Student
{
int number; String name;
Student(int number,String name) {
this.number=number;
- 26 -
this.name=name;
System.out.println(\ } }
class Univer_Student extends Student {
boolean 婚否;
Univer_Student(int number,String name,boolean b) {
super(number,name); 婚否=b;
System.out.println(\婚否=\婚否); } }
public class Class1 {
public static void main (String[] args) throws java.io.IOException {
int i;
Univer_Student zhang=new Univer_Student(5144,\李晓红\ i=System.in.read(); } }
答:运行结果为:I am 李晓红 my number is 5144 婚否=false
15、class Sum
{
int n; float f() {
float sum=0;
for(int i=1;i<=n;i++) sum=sum+i; return sum; }
}
- 27 -
class Average extends Sum {
int n; float f() {
float c; super.n=n; c=super.f(); return c/n; }
float g() {
float c;
c=super.f(); return c/2;
} }
public class Class1 {
public static void main (String[] args) throws java.io.IOException {
Average aver=new Average(); aver.n=100;
float result_1=aver.f(); float result_2=aver.g();
System.out.println(\ System.out.println(\ int i;
i=System.in.read();
} }
答:运行结果为:result_1=50.50 result_2=2525.0
16、
class Student {
- 28 -