请JAVA的高手帮我看看这个程序有什么错误!

来源:百度知道 编辑:UC知道 时间:2024/05/24 19:08:46
public class Employee
{
public static void main(String args[])
{
Employee gongren = new Employee();
public void draw(String number,String name,String salary)
{
System.out.println("员工编号:" + number + ",姓名:" + name + ",工资:" + salary);
}
gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
}
}

public class Employee
{
public void draw(String number,String name,String salary)
{
System.out.println("员工编号:" + number + ",姓名:" + name + ",工资:" + salary);
}
public static void main(String args[])
{
Employee gongren = new Employee();

gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
}
}

你在主方法里又写了一个方法draw()这个是不允许的。

在方法里面不能定义方法
public class Employee{
public static void main(String args[]){
Employee gongren = new Employee();
gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
gongren.draw("0005","张三","2500");
}
public void draw(String number,String name,String sal