Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the difference

 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hallo,
i'd like to know why is there a difference between:
byte[] hallo={75,15,25};
System.out.println(hallo);
System.out.write(hallo);
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The write method puts the bytes from the array directly into the stream, whereas println calls the toString method of the array and puts the bytes representing the resulting String into the stream.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic