JAVA
java
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
import java.util.*;
public class Hospital{
List<Doctor> doctorList = new ArrayList<Doctor>();
List <Patient> patientList = new ArrayList<Patient>();
String hospitalName;
void addDoctor(Doctor o)
{
doctorList.add(o);
}
void addPatient(Patient o)
{
patientList.add(o);
}
Hospital(String name)
{
this.hospitalName=name;
}
public List<Doctor> showDoctors()
{
return doctorList;
}
public List<Patient> showPatients()
{
return patientList;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run