求大神帮忙看看这个程序为什么运行不了,谢谢!!1

天水一墨 2016-10-12 09:17:02
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public abstract class Person {
public abstract void getInformation();//定义一个抽象方法头
public void main(String[] args){
Student student = new Student();
student.getInformation();
student.getAge();
}
}
interface Interface1{
void getAge();
}
class Student extends Person implements Interface1{
public void getInformation() {
String name;
try{System.out.println("please input name:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
name=in.readLine();
System.out.println(name);}catch(Exception e){}
}
public void getAge() {
int age;
try{System.out.println("please input age:");
BufferedReader a = new BufferedReader(new InputStreamReader(System.in));
age=Integer.parseInt(a.readLine());
System.out.println("the age is:"+age);}catch(Exception e){}
}
}
...全文
86 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
姜小白- 2016-10-12
  • 打赏
  • 举报
回复
public static void main(String[] args){ Student student = new Student(); student.getInformation(); student.getAge(); } 没有static,main 方法就不是入口方法了

58,452

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧