Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Polygon's relation to Shape

 
Mike Cunningham
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Java API (1.2.2), it states that Polygon extends Object and implements Shape, Serializable.
In the JQ+ quiz, it states that Polygon MUST extend Shape and NOT implement it.
Which is right? JQ Plus seems to cover the material fairly well...but seeing discrepencies like this just sucks.
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are they talking about java.awt.Polygon implementing public interface Shape? A class cannot extend an interface. A class can extend another class or implement an interface. An interface can extend another interface.

However if the question was about another class named Polygon extending a user class named Shape, that is entirely possible.
 
Mike Cunningham
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm, I'll bounce back 50 questions and double check. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic