• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Arulmozhi Govindaraju
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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??
 
Mahender Parkipandla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Did you debug in which class / line this error is coming?

 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • 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.





 
Campbell Ritchie
Sheriff
Pie
Posts: 49865
71
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 49865
71
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic