Hi

Use Reflection API ,as it will give information about the type of object.


Thank You

Regards
Rahul Singh




-----Original Message-----
From: javaprogrammingwithpassion@googlegroups.com 
[mailto:javaprogrammingwithpass...@googlegroups.com] On Behalf Of Lawrence Louie
Sent: Friday, October 15, 2010 4:42 AM
To: Java Programming Online Training Course By Sang Shin
Subject: [java programming] question on autoboxing.

Hi,

When using autoboxing, how can I find out what the data type is inside
the elements:
        Vector<object> v = new Vector<Object>();
        v.add( "Hello World"  );
        v.add( 10  );
        v.add( 11.0  );

For example, if I need to iterator each element in the vector here,
how can I find out the type of the object here.  I cannot do the
instanceOf, since the element here do not share the interface.

Thx.

Lawrence

--
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en



Mahindra Satyam powered IT for the 2010 FIFA World Cup(TM).
To learn more, visit: www.mahindrasatyam.com/fifa/index.asp

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the 
intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE 
COMPANY INFORMATION. Any review or reliance by others or copying or 
distribution or forwarding of any or all of the contents in this message is 
STRICTLY PROHIBITED. If you are not the intended recipient, please contact the 
sender by email and delete all copies; your cooperation in this regard is 
appreciated.

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to