public interface MultimediaControl {
public void play();
public void stop();
public void previous();
public void next();
}
public class AudioPlayer extends Product implements MultimediaControl {
String audioSpecification;
ItemType mediaType;
@Override //The method play() of type AudioPlayer must override or
implement a supertype method
public void play() {
System.out.println("Playing");
}
@Override //The method stop() of type AudioPlayer must override or
implement a supertype method
public void stop() {
System.out.println("Stopped");
}
@Override //The method previous() of type AudioPlayer must override or
implement a supertype method
public void previous() {
System.out.println("To the previous");
}
@Override
public void next() //The method next() of type AudioPlayer must override or
implement a supertype method{
System.out.println("To the Next");
}
public AudioPlayer(String name, ItemType Type) {
super(name); //The constructor Product(String) is undefined
mediaType = Type;
}
}
还有构造函数中调用父类带参构造函数, 父类中的构造函数 :
public Product(String Name) {
name = Name;
serialNumber = currentProductionNumber;
manufacturedOn = new Date();
}
明明有带String参数的构造?为什么会提示这些错误呢