【发布时间】:2013-05-24 16:57:22
【问题描述】:
好的...所以我已经做了很多试验和错误...我似乎无法将我的 usFormat 方法调用到我的 main 中,我想我已经把整个事情搞砸了,哈哈。 。 你能帮忙的话,我会很高兴。只是...请在初学者级别。
class Date {
String date;
String day;
String month;
String year;
StringTokenizer st;
Scanner sc = new Scanner (System.in);
//instance vars go here
public Date (String date){
while (sc.hasNextLine()) {
st = new StringTokenizer (sc.nextLine());
this.month = st.nextToken();
this.day = st.nextToken();
this.year = st.nextToken();
}
} //end constructor
public String usFormat () {
return month + " " + day + "," + year;
} //end usFormat
public String euFormat () {
return null;
} //end euFormat
public static void main (String[] args){
Date usFormat = new Date (date);
}
}
【问题讨论】:
-
-1。请google您的错误消息,这包含在无数的 SO 问题和在线教程中。
-
这是您完全相同的问题:stackoverflow.com/questions/7379915/…
-
@所有回答者,请关闭重复而不是重复答案。
标签: java