Advertisement
GamerBhai02

1. Employee

Jan 16th, 2025 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | Source Code | 0 0
  1. public class Employee{
  2.     String name, department;
  3.     int id;
  4.     double salary;
  5.     Employee(String name,int id,String department,double salary){
  6.         this.name = name;
  7.         this.id = id;
  8.         this.department = department;
  9.         this.salary = salary;
  10.     }
  11.     void display(){
  12.         System.out.println("Name: "+name+" Id: "+id+" Department: "+department+" Salary :"+salary);
  13.     }
  14.     public static void main(String[] args){
  15.         Employee e1 = new Employee("Name1",1,"d1",292922);
  16.         Employee e2 = new Employee("Name2",2,"d2",654922);
  17.         e1.display();
  18.         e2.display();
  19.     }
  20. }
Tags: employee
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement