+ 1
.write vs .println
whats the different ? sorry but I dont really have the understanding of java programming. I just start few hours ago after my teacher tell me we gonna learn some socket programming this sem.. example : int data; system.out.write(data); // what does this do ?
4 Respostas
+ 1
print() formats the output, while write() just prints the characters it is given. print() handles many argument types, converting them into printable strings of characters with String.valueOf(), while write() just handles single characters, arrays of characters, and strings.
To illustrate the difference, write(int) interprets the argument as a single character to be printed, while print(int) converts the integer into a character string. write(49) prints a "1", while print(49) prints "49".
source: http://www.coderanch.com/t/398792/java/java/write-print
+ 7
// println() prints a line of text to the screen.
+ 4
// After the string, he have the \n, it is used to create the new line, this is for println() in Java
0
Daniel (kabura) which means write store it .. and print display it . right ?