package Application;
public class Application5_1{
public static void main(String args[]){
People people=new People();
people.showPeopleMiss();
System.out.print('\n');
Student student=new Student();
student.number=100101;
student.age=17;
student.showPeopleMiss();
student.tellNumber();
student.add(9,29);
System.out.println("9+29="+student.add(9,29));
System.out.print('\n');
UniverStudent univerStudent=new UniverStudent();
univerStudent.age=21;
univerStudent.showPeopleMiss();
univerStudent.number=6609;
univerStudent.add(9,29);
System.out.print("9+29="+univerStudent.add(9,29)+",");
univerStudent.multi(9,29);
System.out.println("9*29="+univerStudent.multi(9,29));
}
}
/////
package Application;
public class People{
int age=0,hand=2,leg=2;
protected void showPeopleMiss()
{
System.out.print(age+"岁,"+leg+"只脚,"+hand+"只手.");
}
}
/////
package Application;
public class Student extends People{
int number;
void tellNumber()
{
System.out.print("学号:"+number+".");
}
int add(int x,int y)
{
return (x+y);
}
}
///////
package Appication;
public class UniverStudent extends Student{
int multi(int x,int y)
{
return x*y;
}
}
public class Application5_1{
public static void main(String args[]){
People people=new People();
people.showPeopleMiss();
System.out.print('\n');
Student student=new Student();
student.number=100101;
student.age=17;
student.showPeopleMiss();
student.tellNumber();
student.add(9,29);
System.out.println("9+29="+student.add(9,29));
System.out.print('\n');
UniverStudent univerStudent=new UniverStudent();
univerStudent.age=21;
univerStudent.showPeopleMiss();
univerStudent.number=6609;
univerStudent.add(9,29);
System.out.print("9+29="+univerStudent.add(9,29)+",");
univerStudent.multi(9,29);
System.out.println("9*29="+univerStudent.multi(9,29));
}
}
/////
package Application;
public class People{
int age=0,hand=2,leg=2;
protected void showPeopleMiss()
{
System.out.print(age+"岁,"+leg+"只脚,"+hand+"只手.");
}
}
/////
package Application;
public class Student extends People{
int number;
void tellNumber()
{
System.out.print("学号:"+number+".");
}
int add(int x,int y)
{
return (x+y);
}
}
///////
package Appication;
public class UniverStudent extends Student{
int multi(int x,int y)
{
return x*y;
}
}