Default Constructor example - Core Java

Q.  The following program is an example for?

class Student{
int id;
String name;

void display(){System.out.println(id+" "+name);}

public static void main(String args[]){
Student s1=new Student();
Student s2=new Student();
s1.display();
s2.display();
}
}

- Published on 20 Jul 15

a. Parameterized constructor
b. Default Constructor
c. Overloading Constructor
d. None of the above

ANSWER: Default Constructor

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)