-2

I'm writing a class that should implement two interfaces, DNARecord and Comparable.

When I I do something like

 public class FastqRecord implements DNARecord  Comparable<FastaRecord>{}

the class does not compile.

If I do this

 public class FastqRecord implements DNARecord  {}

it works, but I don't know what to do with Comparable. Should I put it on the constructor or how do I add it to the class declaration?

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78
孔伟杰
  • 1
  • 3
  • Possible duplicate of [Can an interface extend multiple interfaces in Java?](http://stackoverflow.com/questions/19546357/can-an-interface-extend-multiple-interfaces-in-java) – Paul Hicks Mar 17 '16 at 19:53

2 Answers2

2

Implement multiple interfaces by separating them with commas.

public class FastqRecord implements DNARecord, Compareable<FastaRecord>
{
}

This has nothing to do with a constructor though.

Paul Hicks
  • 13,289
  • 5
  • 51
  • 78
0

You forgot the comma:

public class FastqRecord implements DNARecord,  Compareable<FastaRecord>{}
Pang
  • 9,564
  • 146
  • 81
  • 122
Vitaliy
  • 11
  • 1