Results 1 to 2 of 2
  1. #1
    Anitha is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default Object Key value pairs

    Hi,

    How to print the objects jey value pairs? It is the User defined object.

    Thanks,
    Anitha.

  2. #2
    kasipandian is offline Member
    Join Date
    Feb 2008
    Posts
    7
    Rep Power
    0

    Smile

    Hi,
    Which object do you want to print? describe your requirement clearly.If it is Map object you can use the following code to print.
    Map testMap = new HashMap();
    testMap.put("key","value");
    Iterator iter = testMap.keySet().iterator();
    while(iter.hasNext()){
    String key = (Integer)iter.next();
    String value = (String)testMap.get(key);
    System.out.println(key +":"+value);
    }

    Regards
    Kasi..

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Replies: 1
    Last Post: 04-17-2008, 10:10 PM
  3. Working with Key-Value Pairs in a Hashtable
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-12-2008, 08:44 PM
  4. Object ID
    By javaplus in forum New To Java
    Replies: 4
    Last Post: 11-26-2007, 12:08 PM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 03:33 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
  •