public class Example{
public static void main(String[] args){
System.out.println("Testing tripvalue:");
double percent=10;
System.out.println("before:"+percent);
tripvalue(percent);
System.out.println("after:"+percent);

System.out.println("************************");
System.out.println("Testing tripleSalary :");
Employee bob=new Employee("bob",5000);
System.out.println("before:"+bob.getSalary());
bob.raiseSalary(15);
System.out.println("after:"+bob.getSalary());

}
public static void  tripvalue(double x)
{
x=3*x;
System.out.println("x is :"+x);
}
}class Employee //这里提示“the type Employee  is already defined”
{
public Employee(String n,double s)
{
this.name=n;
this.salary=s;

}
public String getName(){
return name;
}
public double getSalary(){
return salary;
}
public void raiseSalary(double byPercent)
{
double raise=salary * byPercent /100;
salary+=raise;
}
private String name;
private double salary;
}-----------------
class Employee //这里提示“the type Employee  is already defined”
就是这句出的问题,java2核心技术的例子

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【wolfs】截止到2008-06-28 11:05:37的历史汇总数据(不包括此帖):
    发帖数:72                 发帖分:2200               
    结贴数:68                 结贴分:2140               
    未结数:4                  未结分:60                 
    结贴率:94.44 %            结分率:97.27 %            
    值得尊敬
      

  2.   

    class Employee //这里提示“the type Employee  is already defined” 
    重复定义了呀
      

  3.   

    the type Employee  is already defined说的很明白了,已经定义了类,
    我想问问你的
    this.name=n; 
    this.salary=s;
    在哪定义的?