기본적으로 책에서 Java 연습을하고 있었는데이 소스 코드는 연습 문제에 대한 대답입니다. 그러나 eclipse는 아래에서 세 번째 줄에 "PhoneNumber() 생성자가 정의되지 않았습니다."오류가 있음을 알립니다. 그러나 내가 알기에, 특정 생성자가 올바르게 정의되었으므로 문제가 무엇입니까? 당신의 오류가 말하는Java 생성자가 정의되지 않았습니다.
public class PhoneNumber {
// Only the relevant source codes are posted here.
// I removed other bits cause I'm sure they are not responsible for the
// error
private char[] country;
private char[] area;
private char[] subscriber;
public PhoneNumber(final String country, final String area, final String subscriber) {
this.country = new char[country.length()];
country.getChars(0, country.length(), this.country, 0);
this.area = new char[area.length()];
area.getChars(0, area.length(), this.area, 0);
this.subscriber = new char[subscriber.length()];
subscriber.getChars(0, subscriber.length(), this.subscriber, 0);
checkCorrectness();
}
private void runTest() {
// method body
}
public static void main(final String[] args) {
(new PhoneNumber()).runTest(); // error here saying :
// "The constructor PhoneNumber() is undefined"
}
}
설명 및 솔루션을 제공해 주셔서 감사합니다. 고마워. – Kyle