我在将日历更改为字符串时遇到问题。当我运行该程序时,日历不会更改为日期。这是我的代码:
switch(selection){
case 1:
Calendar cal = Calendar.getInstance();
cal.getTime().toString();
LifeTimeMembers lifetime = new LifeTimeMembers();
lifetime.setName(name);
lifetime.setSurname(surname);
lifetime.setAddress(address);
lifetime.setJoinDate(cal);
members.add(lifetime);
break;
case 2:
cal.add(Calendar.YEAR, 1);
YearlyMembers yearly = new YearlyMembers(name, surname, address, cal);
members.add(yearly);
break;
}
System.out.println("Member added");
有人能帮助我吗?