date cannot be resolved to a type是問題出在哪

看板java作者時間19年前 (2006/03/28 03:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
小弟是初學者 剛寫了一個運用類別的程式 請問一下:跑出了 Exception in thread "main" java.lang.Error: Unresolved compilation problems: date cannot be resolved to a type date cannot be resolved to a type date cannot be resolved to a type at datetest.main(datetest.java:5) 不知錯在哪 麻煩哪位大大知道的話可以說一下嗎? 我是用Eclipse寫的 以下是程式碼 ==================================================================== public class datetest { public static void main(String args[])throws java.io.IOException { date day1; date month1; date year1; java.io.BufferedReader keyin; keyin=new java.io.BufferedReader( new java.io.InputStreamReader(System.in)); System.out.print("input integer"); day1=Integer.parseInt(keyin.readLine()); month1=Integer.parseInt(keyin.readLine()); year1=Integer.parseInt(keyin.readLine()); System.out.print(day1.getday()); System.out.print(month1.getmonth()); System.out.print(year1.getyear()); } } ============================================================ 這是date類別 public class date { private int day,month,year;//date name for the class public date(int i)//constructor to initialize the three variable { day=i;//initialize the day variable }//ending the constructor public void setday(int i)//method to set the day { day=i;//store the day name }//end the set method public int getday()//method to get the day { return day;// }//end the get method public void displaydate()//display the message of getday { System.out.print(getday()); } public date(int j) { month=j; } public void setmonth(int j) { month=j; } public int getmonth() { return month; } public void displaydate() { System.out.print(getmonth()); } public date(int k) { year=k; } public void setyear(int k) { year=k; } public int getyear() { return year; } public void displaydate() { System.out.print(getyear()); } } -- 夫兵者不祥之器物或惡之故有道者不處君子居則貴左用兵則貴右兵者不祥之器非君子 之器不得已而用之恬淡為上勝而不美而美之者是樂殺人夫樂殺人者則不可得志於天下 矣吉事尚左凶事尚右偏將軍居左上將軍居右言以喪禮處之殺人之眾以哀悲泣之戰勝以 喪禮處之道常無名樸雖小天下莫能臣侯王若能守之萬物將自賓天地相合以降甘露民莫 之令而自均始制有名名亦既有夫亦將知止知止可以不殆 173-208.dorm.ncu.edu.tw
文章代碼(AID): #14A3sp00 (java)
文章代碼(AID): #14A3sp00 (java)