-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMain.java
More file actions
60 lines (41 loc) · 1.92 KB
/
Main.java
File metadata and controls
60 lines (41 loc) · 1.92 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
public class Main {
public static void main(String[] args) {
System.out.println("Enter Text >");
// create an event source - reads from stdin
final EventSource eventSource = new EventSource();
// create first observer
final ResponseHandler1 responseHandler1 = new ResponseHandler1();
// subscribe the observer to the event source
eventSource.addObserver(responseHandler1);
// create second observer
final ResponseHandler2 responseHandler2 = new ResponseHandler2();
// subscribe the observer to the event source
eventSource.addObserver(responseHandler2);
// starts the event thread
Thread thread = new Thread(eventSource);
thread.start();
///////////////Prototype Demo ///////////////
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Employee Id: ");
int eid=Integer.parseInt(br.readLine());
System.out.print("\n");
System.out.print("Enter Employee Name: ");
String ename=br.readLine();
System.out.print("\n");
System.out.print("Enter Employee Designation: ");
String edesignation=br.readLine();
System.out.print("\n");
System.out.print("Enter Employee Address: ");
String eaddress=br.readLine();
System.out.print("\n");
System.out.print("Enter Employee Salary: ");
double esalary= Double.parseDouble(br.readLine());
System.out.print("\n");
EmployeeRecord e1=new EmployeeRecord(eid,ename,edesignation,esalary,eaddress);
e1.showRecord();
System.out.println("\n");
EmployeeRecord e2=(EmployeeRecord) e1.getClone();
e2.showRecord();
///////////////End Prototype Demo ///////////////
}
}