Results 1 to 2 of 2
  1. #1
    Reddax is offline Member
    Join Date
    Oct 2014
    Rep Power

    Default Bluej question - Constructors

    I have been given a question about a object creation resulting in the constructor of the Time class being called, and to write the constructor's header
    new Time(21, 39, 55);

    So, would the header be "public Time(21, 39, 55)" ? and i have to give meaningful names to formal parameters, which is what i don't understand. Is it just private int hours; etc? I have also been told to attempt to write the body of the constructor and will need to estimate how the code in the body will work and to invent some fields.
    Help on this would be appreciated

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: Bluej question - Constructors

    The parameters of a constructor are simply type values appropriate for the class (and you can have more than one constructor
    for a given class). The access type (e.g. private, public) is used to describe the instance fields (the things the constructors are

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Question on constructors
    By MW130 in forum New To Java
    Replies: 5
    Last Post: 05-02-2013, 05:20 AM
  2. BlueJ
    By luigihs in forum New To Java
    Replies: 2
    Last Post: 10-17-2012, 08:42 PM
  3. BlueJ - UML
    By Nghi97 in forum New To Java
    Replies: 5
    Last Post: 11-28-2011, 11:03 AM
  4. Class and constructors question.
    By Meta in forum New To Java
    Replies: 19
    Last Post: 04-29-2010, 02:58 AM
  5. BlueJ help
    By Cid17 in forum New To Java
    Replies: 2
    Last Post: 06-29-2009, 07:38 PM

Posting Permissions

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