DEV Community

Vignesh . M
Vignesh . M

Posted on

TASK :

Write a Java program to create a class HRManager with the following specifications:

Instance variables:

    employeeId (int)

    employeeName (String)

    employeeDob (String)

A static constant variable CompanyName initialized with "SOFTWARE COMPANY".
Enter fullscreen mode Exit fullscreen mode

PROGRAM:
//package Interface;

public class Hrmanager {

public int EmployId;
public String EmployName;
public String EmployDob;
public static final String CompanyName ="SOFTWARE COMPANY";

public void printEmployedDetails() {
    System.out.println(EmployId+" "+EmployName+" "+EmployDob+" "+CompanyName);
}

public static void main(String[] args) {
    Hrmanager e1= new Hrmanager();
    System.out.println("Before inititalisation");
    e1.printEmployedDetails();          
    e1.EmployId = 12365;
    e1.EmployName="kumar";
    e1.EmployDob= "27-08-1995";
    System.out.println("After inititalisation");
    e1.printEmployedDetails();

    Hrmanager e2 = new Hrmanager();
    e2.printEmployedDetails();
    }
Enter fullscreen mode Exit fullscreen mode

}

output:
Before initialization
0 null null SOFTWARE COMPANY
After initialization
12365 kumar 27-08-1995 SOFTWARE COMPANY
0 null null SOFTWARE COMPANY

Top comments (0)