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 2 of 2

Thread: contructors, arrays ?? help

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default contructors, arrays ?? help

    Hi

    Can someone please give me some advice on how to do the following question:

    As I have no idea!



    Next alter the default constructor in rotaMaker so that it uses the arrays referenced by the class variables in rotaMakerHelper to initialise all its instance variables. So, for example, shiftsCal should be initialised to a new sorted set that holds the shifts given by the array referenced by the rotaMakerHelper class’s static variable shiftsDays.

    Thanks,

    joe


  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: contructors, arrays ?? help

    Try this:
    shiftsCal = new TreeSet<Integer>();
    for(int i = 0; i< rotaMakerHelper.shiftsDays.length; i++)
    {
    shiftsCal.add(rotaMakerHelper.shiftsDays[i]);
    }

Similar Threads

  1. 2 D arrays problem
    By Pulse_Irl in forum Collections and Generics
    Replies: 2
    Last Post: March 5th, 2010, 04:49 PM
  2. Arrays
    By mlan in forum Java Theory & Questions
    Replies: 2
    Last Post: February 26th, 2010, 10:23 AM
  3. 2d Arrays
    By mgutierrez19 in forum Collections and Generics
    Replies: 5
    Last Post: October 27th, 2009, 04:08 PM
  4. Arrays Of Objects?
    By MysticDeath in forum Object Oriented Programming
    Replies: 2
    Last Post: October 20th, 2009, 09:39 PM
  5. Help with Sort arrays
    By drk in forum Collections and Generics
    Replies: 5
    Last Post: September 6th, 2009, 02:48 AM