Friday, December 20, 2013

The use of super() in a constructor


Hello,


I have this code:


import java.awt.Graphics2D;

import java.util.ArrayList;

import java.util.List;


import javax.xml.bind.annotation.XmlElement;


public class nameofclass{


public nameofclass() {


}


public nameofclass(String id) {

super();

this.id = id;

}

Can anybody explain me why do I call the superclass no-argument constructor (super()), and which is the superclass? There isn't any keyword extends and mentioned name of a superclass? Is it the empty constructor mentioned above the one with parameters?


Thanks in advance



No comments:

Post a Comment