代码是public class Employee
{
private String name;
private double salary;
private Date birthDate; public Employee(String name,double salary,Date DoB)
{
this.name=name;
this.salary=salary;
this.birthDate=DoB;
System.out.println(this.name+" "+this.salary+" "+this.birthDate+" ");
} public Employee(String name,double salary)
{
this(name,salary,null);
} public Employee(String name,Date DoB)
{
this(name,DoB);
}
public static void main(String[] args)
{
Employee e=new Employee("jack",2323.33,1987-6-23);
}
}运行后提示
F:\>javac Employee.java
Employee.java:5: 找不到符号
符号: 类 Date
位置: 类 Employee
private Date birthDate;
^
Employee.java:7: 找不到符号
符号: 类 Date
位置: 类 Employee
public Employee(String name,double salEmployee.java:20: 找不到符号
符号: 类 Date
位置: 类 Employee
public Employee(String name,Date DoB)
^
----------------------------------------------------------
真不知道是哪里出了问题???
{
private String name;
private double salary;
private Date birthDate; public Employee(String name,double salary,Date DoB)
{
this.name=name;
this.salary=salary;
this.birthDate=DoB;
System.out.println(this.name+" "+this.salary+" "+this.birthDate+" ");
} public Employee(String name,double salary)
{
this(name,salary,null);
} public Employee(String name,Date DoB)
{
this(name,DoB);
}
public static void main(String[] args)
{
Employee e=new Employee("jack",2323.33,1987-6-23);
}
}运行后提示
F:\>javac Employee.java
Employee.java:5: 找不到符号
符号: 类 Date
位置: 类 Employee
private Date birthDate;
^
Employee.java:7: 找不到符号
符号: 类 Date
位置: 类 Employee
public Employee(String name,double salEmployee.java:20: 找不到符号
符号: 类 Date
位置: 类 Employee
public Employee(String name,Date DoB)
^
----------------------------------------------------------
真不知道是哪里出了问题???
import java.util.*;public class Employee
{
private String name;
private double salary;
private Date birthDate; public Employee(String name,double salary,Date DoB)
{
this.name=name;
this.salary=salary;
this.birthDate=DoB;
System.out.println(this.name+" "+this.salary+" "+this.birthDate+" ");
} public Employee(String name,double salary)
{
this(name,salary,null);
} public Employee(String name,Date DoB)
{
this(name,DoB);
}
public static void main(String[] args)
{
Employee e=new Employee("jack",2323.33,1987-6-23);
}
}还是有错误,两个错误,帮我看看啊!!!!!------------------------------
F:\>javac Employee.java
Employee.java:28: 找不到符号
符号: 构造函数 Employee(java.lang.String,double,int)
位置: 类 Employee
Employee e=new Employee("jack",2323.33,1987-6-23);
^
Employee.java:22: 递归构造函数调用
public Employee(String name,Date DoB)
^
2 错误F:\>
import java.util.*;public class Employee
{
private String name;
private double salary;
private Date birthDate; public Employee(String name,double salary,Date DoB)
{
this.name=name;
this.salary=salary;
this.birthDate=DoB;
System.out.println(this.name+" "+this.salary+" "+this.birthDate+",");
} public Employee(String name,double salary)
{
this(name,salary,null);
} public Employee(String name,Date DoB)
{
this(name,0,DoB); //salary 的默认子 数字类型为0,,,
}
public static void main(String[] args)
{
Calendar calendar = Calendar.getInstance(); //z这里调用了个时间处理函数
calendar.set(1988, 8, 8);
Date date = calendar.getTime();
Employee e=new Employee("jack",2323.33,date);
}
}
结果如下:jack 2323.33 Thu Sep 08 11:29:30 CST 1988,
怎么显示为Sep(九月)啊,把人看的一头雾水呢!!!!!!!!!!
{
private String name;
private double salary;
private Date birthDate; public OverloadCon(String name,double salary,Date DoB)
{
this.name=name;
this.salary=salary;
this.birthDate=DoB;
System.out.println(this.name+" "+this.salary+" "+this.birthDate+" ");
} public OverloadCon(String name,double salary)
{
this.name=name;
this.salary=salary;
System.out.println(this.name+" "+this.salary+" ");
} public OverloadCon(String name,Date DoB)
{
this.name=name;
this.birthDate=DoB;
System.out.println(this.name+" "+this.birthDate+" ");
}
public static void main(String[] args)
{
Date d = new Date();
d.setYear(87);
d.setMonth(6);
d.setDate(23);
OverloadCon e=new OverloadCon("jack",23.23,d);
}
}