*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object Array" Watch "Object Array" New topic
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
    
    1

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: 6109
    
    6

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: 136
    
    1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object Array