This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Extended JFrame, use 'super'? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Extended JFrame, use Watch "Extended JFrame, use New topic
Author

Extended JFrame, use 'super'?

Adam Till
Ranch Hand

Joined: Oct 11, 2002
Posts: 41
Hi all
For consistency, if you have a class that extends JFrame do you use e.g. super.whatEver(); or just whatEver()? Personaly I like it but not sure what the general way is, if there is one.
Thanks


Adam Till<br />SCJP SCJD SCWCD
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
In a constructor, you can call the superclass constructor using super() syntax.If you don't insert the call to super() as the first line in the constructor, the compiler will insert an implicit no-argument call to the superclass constructor. It is considered good practice to always put in the super() call regardless.
For method calls, you use super.methodName() syntax.If you would omit the "super." prefix, the foobar() method would be recursively calling itself -- probably leading into an endless loop and an eventual death in a stack overflow.
- Peter
 
jQuery in Action, 2nd edition
 
subject: Extended JFrame, use 'super'?
 
Similar Threads
Closing a JFrame
Modal JFrame in VisualAge?????
Pressing a button to open a new window
repaint() problem
How can i hide a JFrame from showing a window in the taskbar?