• Post Reply Bookmark Topic Watch Topic
  • New Topic

Super inside constructor of an extended subclass  RSS feed

 
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is super(); in the subclass ? there is somewhere else? what it does ?
 
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
super() is a way to access the superclass's constructor.

(BTW, you should be formatting your code correctly by now.)
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:super() is a way to access the superclass's constructor.

(BTW, you should be formatting your code correctly by now.)
so the super(name,age) its from the superclass (inside the constructor) biology?
 
Knute Snortum
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling super(name, age) means that the class biology has a constructor with this signature:

 public biology(String name, String age) {

That constructor gets called with the arguments from animals(String name, String age) {
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!