Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sridhar Reddy
OOPS
3 Answer(s)      6 years and 4 months ago
Posted in : Java Interview Questions


what is mean by aggregation? and what is mean by association? explain with an example?

Advertisement
View Answers

September 11, 2008 at 3:43 PM


Hi friend,


Association
It is a relationship between classes of objects which allows one object instance to cause another
to perform an action on its behalf. This relationship is structural,
because it specifies that objects of one kind are connected to objects of another.

Aggregation:

In aggregation , one object is composed of multiple objects and
every object is useless without the relationship.
Suppose there is a car object,
so car object is useless without the tyre or steering object,
and steering object is useless without car.
This type of relationship is called Aggregation.

Thanks


September 11, 2008 at 3:46 PM


Hi friend,

Aggregation is a special kind of association that specifies a whole/part relationship between the aggregate (whole) and a component part. When compared to an ordinary association, some distinguishing characteristics of aggregation include:

* aggregation is an asymmetric relationship
* aggregation is a transitive relationship
* aggregation implies stronger coupling
* behavior (copy, delete, etc.) is normally propagated across an aggregation.


Aggregation is one of two fundamental possibilites to build new classes from existing ones.



September 11, 2008 at 4:52 PM


public class throwtest {
public static void main(String argv[]) {
int i;
try {
i = Integer.parseInt(argv[0]);
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Must specify an argument");
return;
}
catch (NumberFormatException e) {
System.out.println("Must specify an integer argument.");
return;
}

addValue(i);
}
public static void addValue(int i) {
try {
b(i);
}
catch (MyException e) {
if (e instanceof MySubException)
System.out.print("MySubException: ");
else
System.out.print("MyException: ");
System.out.println(e.getMessage());
System.out.println("Handled at point 1");
}
}
public static void b(int i) throws MyException {
int result;
try {
System.out.println("Enter number is = " + i + ".");
result = c(i);
System.out.println("Add Result is = " + result +".");
}
catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
System.out.println("Handled at point 2");
}
finally {
System.out.print("\n");
}
}
public static int c(int i) throws MyException, MyOtherException {
switch (i) {
case 0:
throw new MyException("input is low");
case 1:
throw new MySubException("input still too low");
case 120:
throw new MyOtherException("input is high");
default:
return i+ i;
}
}
}

-----------------------------------

Thanks.


Related Tutorials/Questions & Answers:
OOPs
OOPs  What is OOps?  Object oriented programming organizes a program around its data,i.e.,objects and a set of well defined interfaces to that data.An object-oriented program can be characterized as data controlling
oops concepts
oops concepts  What is polymorphism?Explain with an example. What is abstraction?Explain with an example. What is inheritance?Explain with an example. What is encapsulation?Explain with an example
Advertisements
what is oops in java
what is oops in java  what is oops in java
what is oops in java
what is oops in java  what is oops in java
Java & OOPs
Java & OOPs  Is JAVA a fully Object Oriented Language? or A what degree Java supports Fully OOPs concept?   Java is not a fully object oriented language because Java is not a completely object oriented language
What is oops in php with example?
What is oops in php with example?  Hi, I heard some where that PHP is support OOPS and its new feature is PHP. Every is now using OOPs in PHP. What is oops in php with example? Can anyone give me code example? Thanks
What is OOPs in PHP ?
What is OOPs in PHP ?   Hi, I am a beginner in PHP Programming Application. I have some doubt on What is OOPs in PHP programming. How the OOPs concept helps us in PHP Programming. Please provide me any online reference so that i
Oops Definition - Java Beginners
Oops Definition  What is Abstraction and Encapsulation? What is the Difference Between Abstraction and Encapsulation? Regards M.KethraBalan.  Hi Friend, Abstraction - The process of abstraction in Java is used
What Is OOPS In Java
What Is OOPS In Java In this section we will learn about the basics of Java. Here we will see the concepts of OOPs. We will discuss the basics of OOPs. OOPs, stands for Object Oriented Programming System that specifies a model
oops concepts - Java Interview Questions
oops concepts  what stands for "S" in OOPs ? object oriented programing.....  Hi friend, Object Oriented Programming or OOP is the technique to create programs based on the real world. Unlike procedural programming
using oops concepts - Development process
using oops concepts  i want answer with oops concepts.individual classes with source code and exact out put. You are required to develop a Hotel Reservation System. The system manages information about rooms
using oops concepts - Development process
using oops concepts   You are required to develop a Hotel Reservation System. The system manages information about rooms, reservations, customers... total source code in corejava using oops concepts.  Hi
OOPs Concept
OOPs Concept      ... the OOPs concepts along with  fundamentals  used to develop the java.... This is a technique used to create programs around the real world entities. In OOPs
OOPs concepts in Java
Object-Oriented Programming (OOPs) concepts in Java helps in creating programs that are based on real world. OOPs is very flexible and compatible and hence... application that are developed on the OOPs concepts at first analyze the program
OOPS Concept Abstraction with example - Java Beginners
OOPS Concept Abstraction with example  I am new to java. In java OOPS concept Abstraction means abstract or something. Please explain it with one example  Hi Friend, The process of abstraction in Java is used
Program to read 2 integers using oops concepts
Program to read 2 integers using oops concepts  Write a program to read two integers with the following significance. ? The first integer value represents a time of day on a 24 hour clock, so that 1245 represents quarter
how to insert data from database using oops concepts - Development process
how to insert data from database using oops concepts  Hi, How to insert data from database using oops based concepts.please write the code and send me.using class and constructor..its urgent  Hi Friend, Try
Java7 : OOPs Concepts
JAVA7 : OOPs Concept In this section we will discuss concept of Object..., better termed as OOPs is a paradigm where everything is represented as an object.... Everything in OOPs is written inside the class so that you can reuse the class.You
Inheritance in Java 7
This tutorial describe concept of Inheritance. It is one of OOPs concept
Polymorphism in Java 7
This tutorial describe concept of Polymorphism. It is one of OOPs concept
OOPs and Its Concepts in Java
OOPs and Its Concepts in Java       Brief Introduction to OOP Object Oriented Programming or OOP is the technique to create programs based on the real world
OOP
OOP       OOPs stands... and scenerios. OOPs enables to program the real world objects and easily play with them in our application development scenerios. OOPs focuses on the relevant data
Object-Oriented Language: Java / APIs, Java OOPs
Java OOPs In this section we will learn Object Oriented (OOPs) Concepts  of Java. This will give you brief introduction to the oops features of Java. Java is one of the useful Object Oriented programming language. Other Object
Encapsulation in Java 7
Encapsulation in Java 7 This tutorial describe concept of  Encapsulation. It is one of OOPs concept. Encapsulation : Encapsulation is a way of wrapping up data and methods into a single unit. Encapsulation puts the data safe from
 

 

 

DMCA.com