oop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ndundu
    New Member
    • Feb 2008
    • 1

    #1

    oop

    hello

    I started in oop in java language.
    I don't understand why i must do a default constructor in my class.
    somebody can help me???
    thanks
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by ndundu
    hello

    I started in oop in java language.
    I don't understand why i must do a default constructor in my class.
    somebody can help me???
    thanks
    There is no particular 'law' that every class should have a noargs constructor but
    there are situations where it may come in handy, e.g the Class.newInstan ce()
    method uses it and it can be convenient if the user defined noargs ctor is called.

    kind regards,

    Jos

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      Post code that provides a context for your question. There are very few things you are required to do, in Java or in any language. There can be many things that you should do, depending on your context.

      Comment

      Working...