• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to fix this error [Ljava.lang.String;@1cbc933 in java?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This bean class
private String[] assinproject;
private String[] unassinproject;

public String[] getAssinproject() {
return assinproject;
}

public void setAssinproject(String[] assinproject) {
this.assinproject = assinproject;
}

public String[] getUnassinproject() {
return unassinproject;
}

public void setUnassinproject(String[] unassinproject) {
this.unassinproject = unassinproject;

}


this is action class
claimMainDtlsObj.setAssinproject(request.getParameterValues("Project"));
claimMainDtlsObj.setAssinproject(request.getParameterValues("Project"));

this is DAO class
for (int i =0; i < claimDetailsBean.getUnassinproject().length;i++ )

stmt.setString(3,claimDetailsBean.getUnassinproject()[i]);

for (int i =0; i < claimDetailsBean.getAssinproject().length;i++ )
stmt.setString(3,claimDetailsBean.getAssinproject()[i]);

when execute this i got this [Ljava.lang.String;@1cbc933 please let me know what is the issue??
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Did you debug in which class / line this error is coming?

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not an error. It's just the result of trying to print out a String array. The toString() method on an array doesn't do anything clever, it just inherits from Object. And the version of toString() in Object prints out something that's based on the class name and the hash code. You can look at the documentation to check: java.lang.Object#toString(). The "[L" part indicates an array.

To get the effect you probably want, you need to iterate over the array and print out individual values.





 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My, what a lot of unindented code, and how difficult to read.
You are not getting that output from that code, because you do not have any print statements there. Your error is caused by attempting to print something. I suggest you read the documentation for the Object#toString() method, and work out exactly what the type you are printing is. You can work that out from its class name.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To go all pedantic: The [ part denotes an array and the L and the semicolon are added to names of reference types.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic