Results 1 to 5 of 5
  1. #1
    Meta is offline Member
    Join Date
    Mar 2010
    Posts
    78
    Rep Power
    0

    Default Im a little confused on what classes are!

    I just read a chapter in my java book about classes. It gives an example of a problem and says you will need 3 classes, a customer class, a cars class, and a service quote class. each get different things and do different things. my question is, are all these classes in one program, or are they separate programs that interact with each other somehow.

    because earlier in the book i think i saw a class in one program, but then main was interacting with it from another program or something.

    also whats the difference of constructors and methods? do constructors only initialize things?

  2. #2
    m00nchile is offline Senior Member
    Join Date
    Feb 2010
    Location
    Ljubljana, Slovenia
    Posts
    470
    Rep Power
    5

    Default

    These are very broad questions that we can't really answer in a few short posts. In the most basic term, a class is a definition of an object, and in OOP you don't really think in terms of "this is part of program 1, this is part of program 2". Instead, you think of classes as modules, what you write for one application can be usefull for others as well.

  3. #3
    karno is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    Default

    no.. there class not in separated program. but every class will interact with OOP concept like composition, aggregation , assosiation etc.

    Tugas Besar Information Retrieval IT Telkom 0910-2

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,765
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Meta View Post
    I just read a chapter in my java book about classes. It gives an example of a problem and says you will need 3 classes, a customer class, a cars class, and a service quote class. each get different things and do different things. my question is, are all these classes in one program, or are they separate programs that interact with each other somehow.

    because earlier in the book i think i saw a class in one program, but then main was interacting with it from another program or something.

    also whats the difference of constructors and methods? do constructors only initialize things?
    Suppose you find a book in the library "Build Your Own ICBM"; you read and follow all the instructions in the book and build your own ICBM in your back yard. That book is the class for ICBM objects and you are the constructor.

    Each class definition is in its own book (file) and all books are assembled in one library (the final program).

    kind regards,

    Jos

  5. #5
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Hallo Meta

    because the concepts behind classes arent' trivial it's normal to be confused. i hope with this link http://java.sun.com/docs/books/tutorial/java/concepts/ you find the informations you are looking for.
    Last edited by j2me64; 04-22-2010 at 10:01 AM.

Similar Threads

  1. Got confused with extending classes.
    By nethz13 in forum New To Java
    Replies: 7
    Last Post: 04-19-2010, 01:19 AM
  2. Help i am so confused..:(
    By angeltiner in forum AWT / Swing
    Replies: 6
    Last Post: 04-11-2010, 02:43 AM
  3. confused
    By updev in forum AWT / Swing
    Replies: 6
    Last Post: 11-14-2008, 04:33 PM
  4. a lot confused
    By vineethraj in forum New To Java
    Replies: 4
    Last Post: 01-18-2008, 01:36 AM
  5. what does it mean:confused:
    By sivasayanth in forum New To Java
    Replies: 2
    Last Post: 01-12-2008, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •