Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;  RSS feed

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



I am getting exception:
java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;

on these line:


please advice.
Thanks.
 
author
Posts: 23813
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Babu Singh wrote:
I am getting exception:
java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;

on these line:



It means the list is not holding what you expect... you are expecting the list to contain Object array instances. And it returned a String object.

Henry
 
Marshal
Posts: 62865
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you would appear to be trying to cast a String to some sort of array, which you cannot do.
 
Campbell Ritchie
Marshal
Posts: 62865
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a result set, it might be obtaining a String when you expect an array. Can you actually get arrays out of result sets?
 
Babu Singh
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
resultset returns the rows which all is string.
 
Henry Wong
author
Posts: 23813
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Babu Singh wrote:resultset returns the rows which all is string.



So, why are you treating the strings as object arrays?

Henry
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!