少し背景:
関連する 3 つのクラスがあります: Tester(main method)、DNASequence(object)およびProteinDNA(subclass of DNASequence)。3 つすべてが同じパッケージの下にあります。
のコンストラクター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。