File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Object Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object Array" Watch "Object Array" New topic

Object Array

Vishnu Khera

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

Joined: Jan 03, 2004
Posts: 6109

Vishnu Khera wrote:

You don't need check[whatever] there. You already have the current element in the obj variable.


is equivalent to this:
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136

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

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
I agree. Here's the link:
subject: Object Array
It's not a secret anymore!