Results 1 to 2 of 2
  1. #1
    gapper is offline Member
    Join Date
    Jan 2008
    Rep Power

    Default Getting object type

    I have an arraylist with String, int and Date objects in it. I want to display the contents of the arraylist along with the object types of those contents.

    Java Code:
    		ArrayList a1 = new ArrayList();
    		a1.add(new Date());
    Expected output:
    Java Code:
    Honda - String
    Toyota - String
    2 - int
    Sun Jan 20 07:50:28 CET 2008 - Date
    Please advice.

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    Examine this.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 03:12 AM
  2. List views, a type of object
    By Leprechaun in forum New To Java
    Replies: 2
    Last Post: 02-06-2008, 04:07 AM
  3. Need help with creating array of type object
    By riz618 in forum New To Java
    Replies: 3
    Last Post: 01-29-2008, 07:14 AM
  4. How to cast an Object into a specific type (Integer/String) at runtime
    By in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 02:04 PM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 04: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