Writing to console with System.out and PrintWriter

后端 未结 6 1916
独厮守ぢ
独厮守ぢ 2020-12-29 02:32

While reading about Java I/O, i realized that there are two ways through which i can write to the standard output.

Following is the snippet that uses both the techn

6条回答
  •  难免孤独
    2020-12-29 02:48

    There are not only two ways, you can also find some other ways to do this. For example using Consol class of io package, and may some more classes present for this.

    But if you just want to print something in the consol, then I think first method is the best. Why should you go for 4 to 5 lines of code if it can be done in just 1 line.

提交回复
热议问题