forked from maheshashokit/27_Java_Full_Stack_Repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPassenger.java
More file actions
29 lines (23 loc) · 771 Bytes
/
Passenger.java
File metadata and controls
29 lines (23 loc) · 771 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
public class Passenger {
//Defining the Fields
private String name;
private String email;
private String contactNo;
//Has-a Relationship
public Address add = new Address();
//Defining the public constructor
public Passenger() {
System.out.println("Passenger Class Public Constructor");
}
//Defining the public Parameterized constructor
public Passenger(String name,String email,String contactNo) {
System.out.println("Passenger Class Public Parameterized Constructor");
this.name = name;
this.email = email;
this.contactNo = contactNo;
}
//Defining the Business method for displaying Passenger Information
public void displayPassengerDetails() {
System.out.println("Name::" + name+ " Email::" +email+" ContactNo::" + contactNo);
}
}