java程序中出现两个main函数时,为什么不执行第二个main函数?
java程序中出现两个main函数时,为什么不执行第二个main函数?大家帮忙看一看 谢谢!谢谢! 谢谢!
public class lang
{
public static void main(String[]args)
{
employee[] staff;
staff=new employee[3];
staff[0]=new employee("langhuan",12890);
staff[1]=new employee("langqi",34211);
staff[2]=new employee("qinghong",232323);
for(int i=0;i<staff.length;i++)
{
staff[i].setid();
System.out.println(staff[i].getname()+" "+staff[i].getslary()+" "+staff[i].getID());
}
int n=employee.getnextid();
System.out.println("next id:"+n);
}
}
class employee
{
public employee(String name,double num)
{
name1=name;
num1=num;
id=0;
}
public String getname()
{
return name1;
}
public double getslary()
{
return num1;
}
public int getID()
{
return id;
}
public void setid()
{
nextid++;
id=nextid;
}
public static int getnextid()
{
return nextid;
}
public static void main(String[]args)
{
employee e=new employee("laeif",231342);
System.out.println(e.getname()+" "+e.getslary()+" "+e.getID());
}
private int id;
private double num1;
private String name1;
private static int nextid=0;
}