1noforever  (2007-11-01 13:37:19)
我做了一个简单的java 类,放到C:\jdk1.6.0_03\CoreJavaBook\Corejava\v1\v1ch4 目录下就能成功
放到:C:\jdk1.6.0_03\CoreJavaBook\Corejava\BySelf就过不去 2:
天才狗  (2007-11-01 13:38:32)
路径问题.自己研究去吧.太初级了.3:
noforever  (2007-11-01 13:38:49)
呵呵。好4:
我在C:\jdk1.6.0_03\CoreJavaBook\Corejava\BySelf底下又建了个EmployeeTest 文件夹,然后把那个文件copy过去,成功了。但不知道为啥,能给点提示不 
  
 

解决方案 »

  1.   

    /**
       @version 1.11 2004-02-19
       @author Cay Horstmann
    */import java.util.*;
     
    public class EmployeeTest2
    {  
       public static void main(String[] args)
       {  
          // fill the staff array with three Employee objects
          Employee1[] staff = new Employee1[3];      staff[0] = new Employee1("Carl Cracker", 75000, 1987, 12, 15);
          staff[1] = new Employee1("Harry Hacker", 50000, 1989, 10, 1);
          staff[2] = new Employee1("Tony Tester", 40000, 1990, 3, 15);      // raise everyone's salary by 5%
          for (Employee1 e : staff)
             e.raiseSalary(5);      // print out information about all Employee objects
          for (Employee1 e : staff)
             System.out.println("name=" + e.getName()
                + ",salary=" + e.getSalary()
                + ",hireDay=" + e.getHireDay());
       }
    }class Employee1
    {  
       public Employee1(String n, double s, int year, int month, int day)
       {  
          name = n;
          salary = s;
          GregorianCalendar calendar = new GregorianCalendar(year, month - 1, day);
             // GregorianCalendar uses 0 for January
          hireDay = calendar.getTime();
       }   public String getName()
       {  
          return name;
       }   public double getSalary()
       {  
          return salary;
       }   public Date getHireDay()
       {  
          return hireDay;
       }   public void raiseSalary(double byPercent)
       {  
          double raise = salary * byPercent / 100;
          salary += raise;
       }   private String name;
       private double salary;
       private Date hireDay;
    }