Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what does "super()" ???

Status
Not open for further replies.

frag

Programmer
Dec 7, 2000
321
GB
Hi everybody!

Could anybody please explain me what "super()" does?

Thanx!

frag patrick.metz@epost.de
 
runs the constructor for your base (super) class.

class foo{
protected int _fooint;
public foo(int n){
_fooint = n;
}
}

class myfoo extends foo{

public myfoo(int x){
super(x); // executes foo::foo(int)
System.out.println( this._fooint); // will display value of 'x'
}
}

Good luck
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top