aspose file tools*
The moose likes Beginning Java and the fly likes how to fix this error [Ljava.lang.String;@1cbc933 in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to fix this error [Ljava.lang.String;@1cbc933 in java?" Watch "how to fix this error [Ljava.lang.String;@1cbc933 in java?" New topic
Author

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

Arulmozhi Govindaraju
Greenhorn

Joined: Feb 20, 2013
Posts: 17
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

Joined: Dec 28, 2009
Posts: 21
Hi,
Did you debug in which class / line this error is coming?

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4422
    
    8

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

Joined: Oct 13, 2005
Posts: 39409
    
  28
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
To go all pedantic: The [ part denotes an array and the L and the semicolon are added to names of reference types.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to fix this error [Ljava.lang.String;@1cbc933 in java?