首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

为什么我这个程序运行的时候有异常?

2014-01-26 
为什么我这个程序运行的时候有异常?/*java.lang.NoSuchMethodError: main Exception in thread mainProce

为什么我这个程序运行的时候有异常?

/*java.lang.NoSuchMethodError: main
Exception in thread "main"
Process completed.*/

//why so many Exception

public class MyFather
{
public static void mian(String[] args)throws Exception
{
Person me=new Person(new Name("moon","su"),'M');
Person fa=new Person(new Name("yekui","su"),'M');
Person gp=new Person(new Name("zhenhuai","su"), 'M');
me.setFather(fa);
fa.setFather(gp);
System.out.println(me);
System.out.println(fa);
System.out.println(gp);
}
}
class Person
{
Person(Name name, char sex)
{
this.name=name;
this.sex=sex;
}

Name name()
{
return name;
}
void setFather(Person father )
{
this.father=father;
}
public String toSting()
{

return new String(""+father+"'s father"+this.father);

}


protected Name name;
protected char sex;
//protected String id;
//protected Person mother;
protected Person father;

}
class Name
{
Name(String first, String last)
{
this.first=first;
this.last=last;
}

String first()
{
return first;
}
String last()
{
return last;
}
private String first;
private String last;
}

------解决方法--------------------------------------------------------