我看了一下你的代码
package shiyide;
class Date implements Cloneable{
int year,month,day;
void setYear(int y){year=y;}
void setMonth(int m){month=m;}
void setDay(int d){day=d;}
void setDate(int y,int m,int d){
year=y;
month=m;
day=d;
}
int getYear(){return year;}
int getMonth(){return month;}
int getDay(){return day;}
public String toString() {
return year+"nian"+month+"yue"+day+"hao";
}
public Object clone()throws CloneNotSupportedException{
return super.clone();
}
}
class Card implements Cloneable{
String name,address,nativ,sex,nation;
int num;
Date birthday;
Card(){
}//错误在这里 你在你的RIDCard类中中申明Card类的时候 你使用的是默认的构造函数,而你在Card类中并没有默认的构造函数有的只是下面的构造函数,你应该在申明对象的时候要不就用带构造函数的,要不就在Card类中申明一个默认的构造函数,如上.
Card(Date birthday){
this.birthday=new Date();
}
void setName(String n){name=n;}
void setAddress(String a){address=a;}
void setNativ(String na){nativ=na;}
void setSex(String s){sex=s;}
void setNation(String nat){nation=nat;}
void setNum(int nu){num=nu;}
void setCard(String n,String a,String na,String s,String nat,int nu){
name=n;
address=a;
nativ=na;
sex=s;
nation=nat;
num=nu;
}
String getName(){return name;}
String getAddress(){return address;}
String getNativ(){return nativ;}
String getSex(){return sex;}
String getNation(){return nation;}
int getNum(){return num;}
public String toString(){
return "xingming:"+name+'\n'+"xingbie"+sex+"mingzh"+nation+'\n'+"birthday"+birthday+'\n'+"add"+address+'\n'+"Number"+num;
}
public Object clone() throws CloneNotSupportedException{
return super.clone();
}
}
public class RIDCard {
public static void main(String args[]){
Date d = new Date();
Card t = new Card();
}
}