Javatpoint Logo
Javatpoint Logo

Java employee details program

In Java, the most searching program is of employee details. An employee is an entity that can have several attributes like id, name, and department, etc. In order to create a java employee details program, we need to create a class for the employee entity and create properties of the employees.

We will create the getter and setter for getting and setting the values of the properties. In the main class, we will create the object of the Employee class, and by using its object, we will access the properties of the Employee class.

The code of the employee details program is very easy to understand. Let's implement the code of the above theory.

EmployeeDetails.java

Output

Employee [emp_id = 101, salary = 15000, name = Emma Watson, address = New Delhi, department = IT, email = Emmawatson123@gmail.com]
 Salary is incremented 
Employee [emp_id = 101, salary = 15750, name = Emma Watson, address = New Delhi, department = IT, email = Emmawatson123@gmail.com]

In the above program, we have created limited properties of the Employee class. You can create the number of properties for the Employee class. In the above code, we not only show the employee details but also access the property value using the setters. We update the value of a property based on the conditions too.






Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA