저는 Java가 처음이에요. 컴파일에 자주 발생하는 오류가 있습니다. 나는 다른 해결책을 시도했지만 아무 것도 나를 위해 일했다. 그런 다음라는 다른 파일이Java- "기호를 찾을 수 없습니다"
package edu.kit.informatik.calendar;
public final class DateTime {
private final Date date; // Placeholder value
private final Time time; // Placeholder value
public DateTime(Date date, Time time){
this.date = date;
this.time = time;
}
public Date getDate(){
return date;
}
public Time getTime(){
return time;
}
public int getYear(){
return date.getYear();
}
public int getMonthValue(){
return date.getMonthValue();
}
public Month getMonth(){
return date.getMonth();
}
public int getDayOfYear(){
return date.getDayOfYear();
}
public int getDayOfMonth(){
return date.getDayOfMonth();
}
public int getHour(){
return time.getHour();
}
public int getMinute(){
return time.getMinute();
}
public int getSecond(){
return time.getSecond();
}
public String toString(){
return date.toString() + "T" + time.toString();
}
}
:
package edu.kit.informatik.calendar;
public final class Date {
private final int year; // Placeholder value
private final int month; // Placeholder value
private final int day; // Placeholder value
public int dayOfYear;
public Date(int year, int month, int dayOfMonth){
this.year = year;
this.month = month;
this.day = dayOfMonth;
}
public DateTime atTime(Time time){
DateTime dateTime = new DateTime(this, time);
return dateTime;
}
public int getYear(){
return year;
}
public int getMonthValue(){
return month;
}
public int getDayOfMonth(){
return day;
}
public int getMonth(){
return Month.ofIndex(month);
}
나는 이런 식으로 뭔가를 DateTime.java라는 또 다른 파일에서 : 여기 내 Date.java FRM 코드 조각은, 달력을 만들어야합니다 Time.java하지만 다른 두 가지처럼 보입니다.
나는 DateTime.java
C:\Users\Marcel\Documents\Programmieren\assignment01- solution\TaskE\edu\kit\informatik\calendar>javac DateTime.java
DateTime.java:12: error: cannot find symbol
private final Date date; // Placeholder value
^
symbol: class Date
location: class DateTime
DateTime.java:13: error: cannot find symbol
private final Time time; // Placeholder value
^
symbol: class Time
location: class DateTime
DateTime.java:15: error: cannot find symbol
public DateTime(Date date, Time time){
^
symbol: class Date
location: class DateTime
DateTime.java:15: error: cannot find symbol
public DateTime(Date date, Time time){
^
symbol: class Time
location: class DateTime
DateTime.java:20: error: cannot find symbol
public Date getDate(){
^
symbol: class Date
location: class DateTime
DateTime.java:23: error: cannot find symbol
public Time getTime(){
^
symbol: class Time
location: class DateTime
DateTime.java:33: error: cannot find symbol
public Month getMonth(){
^
symbol: class Month
location: class DateTime
7 errors
아마'Date' 클래스를 컴파일하지 않았을 것입니다. 'javac'에 패스하거나 더 나은 IDE를 사용하십시오. – chrylis
이것이 내 문제를 해결할 수 있다면 나는 아무 것도 말하지 않는다. –
@MarcelM. 수정 - 그들 중 하나는 ....하지만 당신은 많은 가능한 문제/해결책 중 어느 것이 당신과 일치하는지 알 수 없습니다. –