In other words, an Object. You can tell quite easily: the starting [ indicates it's an array. The following is the element type name: an L to indicate it's an object type, followed by the fully qualified class name and a ;. For example, [Ljava.lang.String; indicates a String.
Instead of an L followed by the class name and a ;, you can also get one of these:
- B for byte
- S for short
- I for int
- J for long (L is taken)
- F for float
- D for double
- C for char
- Z for boolean (B is taken)
So, if you ever see [I, that indicates an int.
To go one step further, if you encounter multiple occurrences of [ that means that you get an array of an array (of an array etc):
- [I indicates int
- [[I indicates int
- [[[I indicates int
Are you sure the contents are instances of either int or String? If it's an Object, instanceof String will return false even if all elements are Strings.
In fact, I would change the method. Create a new class (PaymentDetails or something) that has fields that coincide with the two ints and the String. Then let the method create a List of this class (e.g. List<PaymentDetails>). The loop will create one instance of this class for each row.
Joined: Jun 05, 2010
Thanks Rob for your reply
This is what i tried
The sql query is related to TransportPaymentEntity
It gives an exception(ClassCastException), that Object cannot be casted to TransportPaymentEntity
Jesper de Jong, yes i am using hibernate. getLastPaymentData() returns a list. As i have said, in this method, i am passing a SQL query, and it fetches me value of property of TransportPayementEntity. I can get those values by number of if conditions ,(using instance of Integer,or string). But, that seems very odd.