File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes super()  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "super()  " Watch "super()  " New topic
Author

super()

abhinas raj
Ranch Hand

Joined: Jun 02, 2012
Posts: 47
why super() is always first statement inside any local context
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Not necessarily if you have overloaded constructors.
If its not super(), what else you can have? Can you think of a class that is not an Object?


SCJP, SCWCD.
|Asking Good Questions|
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

The rules of the Java language say that the parent class's constructor must complete before the child's constructor executes. The is enforced by requiring that the first statement in every constructor (except Object's) is a call to either a parent's constructor or to another constructor in the current class (which will eventually lead to a current class c'tor that invokes a parent c'tor).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: super()
 
Similar Threads
The winners...
WA #1.....word association
regarding this or super call in constructors
can I use sdk 1.5?
clared SCWCD with 91%