一点背景:
涉及三个类Tester(main method):DNASequence(object)和ProteinDNA(subclass of DNASequence)。这三个都在同一个包下。
的构造函数ProteinDNA接受一个对象DNASequence和一个整数
public class ProteinDNA extends DNASequence{
public ProteinDNA(DNASequence dna, int startAt){ //this is the constructor
编译类ProteinDNA在构造函数中给我一个错误。
Eclipse中的错误是:
"Implicit super constructor `DNASequence()` is undefined.
Must explicitly invoke another constructor"
jGrasp 中的错误是:
ProteinDNA.java:16: error:
constructor DNASequence in class DNASequence cannot be applied to given types;
public ProteinDNA(DNASequence dna, int startAt)^{
required: String
found: no arguments
reason: actual and formal argument lists differ in length"
我究竟做错了什么?Tester 类为 . 提供了ProteinDNA一个适当构造的实例DNASequence。