Meaning full Example for Aggregation - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Meaning full Example for Aggregation

Meaning full Example for Aggregation

public class Address
{
 String city,state,country;
public Address(String city,String state,String country)

{
 this.city=city;
this.state=state;
this.country=country;
}
}
class Emp
{
  int id;
String name;
Address address;

public 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("noida","Utter pardesh","India");
 Address address2=new Address("Gorakhpur","Uttar pardesh","India");

 Emp e=new Emp(111,"shashi",address1);
Emp e2=new Emp(112,"ravi",address2);
 e.display();
e2.display();
}
}


About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.