Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 26th, 2002, 04:05 PM
justin_dago justin_dago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: new york
Posts: 84 justin_dago User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
super()

i know what
super.someMethod();
does, but how about:
super();

i've often seen it used within a contructor's body:
Code:
public SomeClass {
        protected member;
        
        public SomeClass() {
                  super();
        }
}



thanks in advance.


=-=-=-=-=-=-=-=-=
justin.dago
=-=-=-=-=-=-=-=-=

Reply With Quote
  #2  
Old July 26th, 2002, 08:46 PM
dhtmlkitchen dhtmlkitchen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Boston, MA
Posts: 30 dhtmlkitchen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
It calls the constructor for the superclass.
__________________
http://dhtmlkitchen.com/

Reply With Quote
  #3  
Old July 27th, 2002, 12:51 PM
justin_dago justin_dago is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: new york
Posts: 84 justin_dago User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
that's what i suspected... thanks

i've enjoyed your site for quite some time now.. thanks



______________________
justin.dago

Reply With Quote
  #4  
Old August 5th, 2002, 11:04 AM
just69 just69 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 0 just69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Super() must only appear in the child class' matching constructor, and must be the first line.

eg:
----------------------------------------------------------
public class Parent {

public Parent() {
// A
}

public Parent(String str) {
// B
}

}
----------------------------------------------------------
public class Child extends Parent {

public Child() {
super(); // calls A
// do more
}

public Child(String str) {
super(); // calls B
// do more
}

}
----------------------------------------------------------

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > super()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway