java吧 关注:1,238,169贴子:12,708,633
  • 3回复贴,共1

求大神帮忙看一下哪出问题了

取消只看楼主收藏回复

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;
}
}


1楼2015-11-01 15:58回复


    2楼2015-11-01 16:01
    回复
      我直接保存在C盘上,
      一直不太会用package语句,这个程序若果都不加package就可以运行,????


      3楼2015-11-01 16:03
      回复


        4楼2015-11-01 16:25
        回复