Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes using superclass constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using superclass constructor" Watch "using superclass constructor" New topic

using superclass constructor

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 386

My question is, if I want to call super constructor outside of GraphicalDice constructor, can I do that ?

Tom Reilly

Joined: Jun 01, 2010
Posts: 618
A constructor can only be called from another constructor. And a further restriction is a constructor can only be called from the first line of another constructor.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Why would you like to invoke the super constructor from another location?

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I agree. Here's the link:
subject: using superclass constructor
It's not a secret anymore!