| Author |
Object Array
|
Vishnu Khera
Greenhorn
Joined: Nov 29, 2008
Posts: 24
|
|
I have placed my questions within the code.
|
 |
harshvardhan ojha
Ranch Hand
Joined: Jul 26, 2007
Posts: 157
|
|
Hi Vishnu, you need to check your beans
I am providing you code snippet here for help
Hope this will help.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5836
|
|
Vishnu Khera wrote:
You don't need check[whatever] there. You already have the current element in the obj variable.
This:
is equivalent to this:
|
 |
Red Smith
Ranch Hand
Joined: Aug 05, 2007
Posts: 105
|
|
Vishnu Khera wrote:
That version of the for statement would not use check with an index, e.g.: check[i] the way this version does:
The version you are using puts each check element into obj as it loops. So you access obj each time, not check with a subscript.
Vishnu Khera wrote:
obj.getClass().getCanonicalName() will give the type that you can do a String compare on or use instanceof with.
|
 |
Vishnu Khera
Greenhorn
Joined: Nov 29, 2008
Posts: 24
|
|
Jeff and Red, you are awesome Thank you so much
Oops.. this was a very easy one got carried away with all these concepts of arrays, reference type - type conversions
getCanonicalName() was really helpful
|
 |
 |
|
|
subject: Object Array
|
|
|