-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAggregation.java
More file actions
38 lines (32 loc) · 1.06 KB
/
Aggregation.java
File metadata and controls
38 lines (32 loc) · 1.06 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
class Address {
String city,state,country; //global variable
Address(String city, String state, String country) { //local variable
this.city = city;
this.state = state;
this.country = country;
}
}
//------------------------------
class Emp {
int id;
String name;
Address address;
Emp(int id, String name,Address address) {
this.id = id;
this.name = name;
this.address=address;
}
void display(){
System.out.println(id+" "+name);
System.out.println(address.city+" "+address.state+" "+address.country);
}
public static void main(String[] args)
{
Address address1=new Address("gzb","UP","india");
// Address address2=new Address("delhi","ncr","india");
Emp e=new Emp(111,"varun",address1);
//Emp e2=new Emp(112,"arun",address2);
e.display();
// e2.display();
}
}