I'm still fairly new to this so I maybe wrong but isn't this just an
example of the fact that there are a couple of ways to instantiate an
array. Similarly with stings
String str = "abc";
is the same as
String str = new String("abc");
Both ways are equivalent, the difference is just syntactic
Hi Casey,
> In the following code snippet, why is it necessary to create a new
> String[]?
>
> // Make a normal 52-card deck
> String[] suit = new String[] {"spades", "hearts", "diamonds",
> "clubs"};
> String[] rank = new String[]
>
> {"ace","2","3","4","5","6","7","8","9
I added this to the class:
@Override
public String toString()
{
return this.name + " " + Integer.toString(age);
}
and now it at least shows the information, but how would you access
the individual instance variables from the container?
Cheers!
Dusty
On Feb 7, 12:00 pm,
Instead of using the putAll() method of TreeHash; I passed the HashMap
object as parameter when creating the TreeHash object and printed out
the TreeHash:
TreeMap treeMap = new TreeMap(map);
System.out.println("My hash map in sorted order" + treeMap);
and it works.
On Oct 17, 4:11 pm, miga
On Oct 17, 6:18 am, dzgaga <[EMAIL PROTECTED]> wrote:
> Miga -
> Fantastic. Thanks. It's much simpler and more elegant.
>I suppose it's
> a matter of getting more familiar with the libraries.
It is just a matter to go slowly through the resources url mentioned
in the lesson:
http://java.sun.com
Miga -
Fantastic. Thanks. It's much simpler and more elegant. I suppose it's
a matter of getting more familiar with the libraries. I somehow missed
TreeMap's putAll() functionality.
Best,
Dennis
On Oct 17, 12:02 am, miga <[EMAIL PROTECTED]> wrote:
> On Oct 16, 11:06 pm, dzgaga <[EMAIL PROTECTED]
On Oct 16, 11:06 pm, dzgaga <[EMAIL PROTECTED]> wrote:
> (3.1) Build and run a simple application that uses HashMap
>
> Part 4 of this segment suggests for your own excercise, please do the
> following ...
> and then asks to "Display them in both unsorted and sorted order"
>
> The best solution