不知道哪里错了,求指教
程序如下:
package com.Sixping.Ncre;
import java.util.*;
public class AbstractClassTest {
public static void main(String[] args) {
Person[] people=new Person[2];
people[0]=new Employee0("张浩", 50000, 1989, 10, 1);
people[1]=new Student0("李明", "计算机科学");
for(Person p:people){
System.out.println(p.getName()+","+p.getDescription());
}
}
}
abstract class Person{
public Person(String n) {
name=n;
}
public abstract String getDescription();
public String getName(){
return name;
}
private String name;
}
class Employee0 extends Person{
public Employee0(String n,double s,int year,int mouth ,int day){
super(n);
salary=s;
GregorianCalendar calendar=new GregorianCalendar(year ,mouth-1,day);
hireDay=calendar.getTime();
}
public String getDescription() {
return String.format("公司雇员,年薪是¥%。2f。", salary);
}
private double salary;
private Date hireDay;
}
class Student0 extends Person{
public Student0(String n, String m) {
super(n);
major=m;
}
public String grtDescription() {
return "大学生,专业是"+major+"。";
}
private String major;
}
错误信息:
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = '。'
at java.util.Formatter.checkText(Formatter.java:2502)
at java.util.Formatter.parse(Formatter.java:2484)
at java.util.Formatter.format(Formatter.java:2413)
at java.util.Formatter.format(Formatter.java:2366)
at java.lang.String.format(String.java:2770)
at com.Sixping.Ncre.Employee0.getDescription(AbstractClassTest.java:34)
at com.Sixping.Ncre.AbstractClassTest.main(AbstractClassTest.java:11)