Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java getBytes()

Tags:

java

Do you know the problem as to why i am not getting Hello

byte f []  ="hello".getBytes();

System.out.println(f.toString());
like image 916
BANSAL MOHIT Avatar asked Jan 22 '23 07:01

BANSAL MOHIT


1 Answers

Because byte[]#toString() is (usually) not implemented as new String(byteArray), which would lead to the result you expect (e.g. System.out.println(new String(byteArray));.

You may want to give this page an eye...

like image 72
Romain Avatar answered Feb 06 '23 02:02

Romain