Results 1 to 2 of 2
  1. #1
    Razorfc is offline Member
    Join Date
    Mar 2012
    Rep Power

    Default Java collections maps and lists

    3. DO -Create a new class called Kangaroo with an int kangarooNumber thatís initialized in the constructor. Give it a very simple method called hop( ) thatís prints out which kangaroo number this is, and that itís hopping. Create a List and add a group of Kangaroo objects to the List. Now use the get( ) method to move through the List and call hop( ) for each Kangaroo.

    4. Modify the above Exercise so you can use an Iterator to move through the List while calling hop()

    2. Take the Kangaroo class done in the List exercises and put it in a Map instead, associating the name of the Kangaroo as a String (the key) for each Kangaroo(the value) you put in the table. Get an Iterator for the keySet( ) and use it to move through the Map, looking up the Kangaroo for each key and printing out the key and telling the kangaroo to hop( ). Use generics.

    BUt i don't really get it these question as i kind don't understand

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Java collections maps and lists

    I'm sure you don't expect someone here to do your homework for you or fill in for your instructor. The questions are quite explicit; if you don't understand them at all you need to start with this Tutorial Trail: Learning the Java Language (The Javaô Tutorials)

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Converting Lists to Maps
    By Suzanne M in forum Advanced Java
    Replies: 0
    Last Post: 12-24-2011, 02:37 AM
  2. Java api for goole maps
    By mike_ledis in forum New To Java
    Replies: 0
    Last Post: 07-16-2011, 10:24 PM
  3. Comparing objects: lists and maps
    By LucasH in forum Advanced Java
    Replies: 7
    Last Post: 05-24-2011, 06:41 PM
  4. Java collections
    By learn2java in forum Advanced Java
    Replies: 6
    Last Post: 05-01-2011, 03:12 AM
  5. google maps static api on java se
    By shubham.velocity in forum Networking
    Replies: 2
    Last Post: 11-14-2010, 10:09 PM

Tags for this Thread

Posting Permissions

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