-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmploy.java
More file actions
40 lines (37 loc) · 753 Bytes
/
Employ.java
File metadata and controls
40 lines (37 loc) · 753 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
31
32
33
34
35
36
37
38
39
40
package ObjectClass_java;
public class Employ {
String name;
int id;
double salary;
Employ()
{
}
Employ(String name, int id, double salary)
{
this.name=name;
this.id=id;
this.salary=salary;
}
@Override
public String toString()
{
return "Name is: "+name+" ID is: "+id+" Salary is: "+salary;
}
public int hashCode()
{
return id;
}
@Override
public boolean equals(Object obj)
{
Employ e=(Employ)obj;
return this.name.equals(e.name) && this.id==e.id && this.salary==e.salary;
}
public void finalize()
{
System.out.println("detach system connection");
System.out.println("detach database connection");
System.out.println("detach network connection");
System.out.println("===========================");
}
}