Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: UnderStanding Compostion(Please tell me if i understand the concept correctly)

  1. #1
    Member
    Join Date
    Jun 2012
    Posts
    105
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default UnderStanding Compostion(Please tell me if i understand the concept correctly)

    I am a newbie at Java, and I have been following thenewboston Java tutorials on youtube. And Bucky introduced me to a concept called Composition. Basically composition allows you to turn a class into an object. This is beneficial because you don't have to make any changes to your main class. It other words, I can create a brand new class and create an object that references another class.

    Please correct me if I am wrong. I am trying to build a solid base.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: UnderStanding Compostion(Please tell me if i understand the concept correctly)

    Basically composition allows you to turn a class into an object.
    Composition refers to creating classes composed of other classes - it is often contrasted with inheritance (for instance, 'Composotion over Inheritance'). For creating objects from classes, see
    Lesson: Classes and Objects (The Java™ Tutorials > Learning the Java Language)
    Creating Objects
    Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
    Last edited by copeg; July 5th, 2012 at 09:09 AM.

  3. #3
    Member
    Join Date
    Jun 2012
    Posts
    105
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: UnderStanding Compostion(Please tell me if i understand the concept correctly)

    I kind of thought it was connecting classes to another class.

Similar Threads

  1. [SOLVED] Quick Question: Did I understand these directions correctly?
    By msinc210 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 3rd, 2012, 03:03 PM
  2. In memory concept
    By VaniRathna in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: February 6th, 2012, 06:48 AM
  3. Help with a GUI Concept
    By UnKnown Conceptz in forum AWT / Java Swing
    Replies: 1
    Last Post: January 28th, 2012, 08:53 AM
  4. Need help with a interface concept
    By drakenlord in forum Object Oriented Programming
    Replies: 2
    Last Post: September 13th, 2011, 02:17 PM
  5. Doubt in Encapsulation concept
    By nareshn in forum Object Oriented Programming
    Replies: 1
    Last Post: January 19th, 2011, 02:20 AM