REGISTER FREE to Receive Instant Job

Friday, 5 December 2014

What is the purpose of default constructor

What is the purpose of default constructor?

The default constructor provides the default values to the objects. The java compiler creates a default constructor only if there is no constructor in the class. For More Details

public class Employee_reg {

int emp_id;

String emp_name;

int age;

void show(){System.out.println(emp_id+"-"+emp_name+"-"+age);}

public static void main(String arg[]){

Employee_reg emp1=new Employee_reg();

emp1.show();

      }


}

1 comment:

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.