wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes problem with constructor and super Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with constructor and super" Watch "problem with constructor and super" New topic
Author

problem with constructor and super

humanoidi ufo
Greenhorn

Joined: Jan 31, 2006
Posts: 2
I have a class that extends another. There is something wrong with my constructor, but what?



It gives the following error message:
Suklaajaatelokone.java:19: kermanKulutus has private access in Jaatelokone
super.Jaatelokone(this.kermanKulutus, this.sokerinKulutus);
^
Suklaajaatelokone.java:19: sokerinKulutus has private access in Jaatelokone
super.Jaatelokone(this.kermanKulutus, this.sokerinKulutus);
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
Originally posted by humanoidi ufo:
I have a class that extends another. There is something wrong with my constructor, but what?



It gives the following error message:
Suklaajaatelokone.java:19: kermanKulutus has private access in Jaatelokone
super.Jaatelokone(this.kermanKulutus, this.sokerinKulutus);
^
Suklaajaatelokone.java:19: sokerinKulutus has private access in Jaatelokone
super.Jaatelokone(this.kermanKulutus, this.sokerinKulutus);


If you are explicitly calling the constructor of the parent class via super ,then the first line of the constructor of the subclass must call the constructor as super(parameters of the parent class constructor).

Regards,
JD
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"humanoidi ufo,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names.

You can edit your name here. Thank you for your prompt attention!

-Marc


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
wood burning stoves
 
subject: problem with constructor and super