forked from maheshashokit/27_Java_Full_Stack_Repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasAInheritanceClient.java
More file actions
38 lines (29 loc) · 1.08 KB
/
HasAInheritanceClient.java
File metadata and controls
38 lines (29 loc) · 1.08 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
public class HasAInheritanceClient {
public static void main(String[] args) {
//Creating the main Object i.e.,Passenger Class object
//Access Address object through Passenger Object i.e.,pas
pas.add.setAddressDetails("1-2-3", "ABC", "Hyderabad", "1212121");
//printing the object
System.out.println(pas.add);
System.out.println(pas.add.toString());
//Calling the display methods using Passsenger Object
pas.displayPassengerDetails();
pas.add.displayAddressInfo();
System.out.println("Passenger ::::" + pas);
System.out.println("Passenger ::::" + pas.toString());
Integer i = 30;
System.out.println("Integer :::::" + i);
System.out.println("Integer :::::" + i.toString());
//Widening i.e.,Implicit Casting
long lg =36987;
System.out.println("lg ====" + lg);
float ft = lg;
System.out.println("Float Value::::" + ft);
//narrowing i.e.,Explicit Casting
int a = 40000;
System.out.println("a =" + a);
short sh =(short) a;
System.out.println("sh =" + sh);
}
}