Basically, I was doing a Java exercise in a book and this source code is its answer to the exercise. However, eclipse says there is an error at the third line up from the bottom, saying "- The constructor PhoneNumber() is undefined". But as I understand, that specific constructor is defined correctly so what is the problem?
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"
}
}