|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 =-=-=-=-=-=-=-=-= |
|
#2
|
|||
|
|||
|
It calls the constructor for the superclass.
__________________
http://dhtmlkitchen.com/ |
|
#3
|
|||
|
|||
|
that's what i suspected... thanks
i've enjoyed your site for quite some time now.. thanks ______________________ justin.dago |
|
#4
|
|||
|
|||
|
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 } } ---------------------------------------------------------- |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > super() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|