Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

byte[] to string - Not working

 
Johannes Thorén
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason my byte[].toString() does not result in a string that represents the content of the byte array. I got this code:


I get this as output: [B@1732a4df


But when i do this, it works:

I get this output: start_game


This is the code that creates msg:


Does anyone know why my byte array does not result in the string "start_game" when converting with toString() ?
 
Harsha Smith
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dupliacate post! I answered this question yesterday.

change line 3 of your first code to



Johannes Thorén, you aren't concentrating.
 
Harsha Smith
Ranch Hand
Posts: 287
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic