View Single Post
  #1 (permalink)  
Old 12-03-2010, 07:54 PM
davie davie is offline
Junior Member
 

Join Date: Nov 2009
Posts: 9
Thanks: 5
Thanked 1 Time in 1 Post
davie is on a distinguished road
Default how to initialise set in a constructor

Hi, I need to initialise a set in the constructor. I have a set that already contains some values called "numbers" but I need to initialise this set called "newNumbers" with the same values in the constructor. The code I have tried is:

Java Code
 public PhoneBook()
  {
     super();
     this.newNumbers = new TreeSet<Integer>();
     this.newNumbers = numbers;
}
im a complete novice so im probably going about this the wrong way.

Thankyou in advance to anyone willing and able 2 help.
Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence