Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Employee{
- String name, department;
- int id;
- double salary;
- Employee(String name,int id,String department,double salary){
- this.name = name;
- this.id = id;
- this.department = department;
- this.salary = salary;
- }
- void display(){
- System.out.println("Name: "+name+" Id: "+id+" Department: "+department+" Salary :"+salary);
- }
- public static void main(String[] args){
- Employee e1 = new Employee("Name1",1,"d1",292922);
- Employee e2 = new Employee("Name2",2,"d2",654922);
- e1.display();
- e2.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement