What is aggregation? "Have a" or "May have" relationship Aggregation is special type of association Life time of Component object is independent from its container object E.g A school has one student class Student { String name; Student () { name= null ; } Student ( String n ) { name=n; } void setName ( String n ) { name=n; } String getName () { return name; } } class School { Student st; School ( ) { st= null ; } School ( Student s ){ st=s; } void studentName (){ System.out.println ( st.getName ()) ; } } class Post { public static void main ( String a []){ Student st= new Student ( "Imran" ) ; School s= new School ( st ) ; s.studentName () ; } } Output Hello ...
Java tutorials and example codes to deliver the basic concept. Blog contains lots of code examples in java.
ITS REALLY HELPFUL MAANNNNN.........
ReplyDeleteKINDLY UPLOAD MORE ABOUT JAVA ITS SEEMS TO BE VERY SIMPLE EXPLAINATION
ReplyDeleteWWW.CPROGRAMMING.COM
ReplyDelete