-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQue-17.java
More file actions
30 lines (30 loc) · 719 Bytes
/
Copy pathQue-17.java
File metadata and controls
30 lines (30 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Create two objects of employee and display ID, Name and salary (In double) pass the parameter through Constructor.
//By: Parth Panjwani
class Employee
{
int id;
String name;
double salary;
Employee(int id,String name,double salary)
{
this.id = id;
this.name = name;
this.salary = salary;
}
void display()
{
System.out.println("ID: "+id);
System.out.println("Name: "+name);
System.out.println("Salary: "+salary);
}
}
class Que17
{
public static void main(String[] args)
{
Employee e1 = new Employee(1,"Raj",10000);
Employee e2 = new Employee(2,"Ravi",20000);
e1.display();
e2.display();
}
}