?? printstreamdemo.java
字號:
import java.io.PrintStream;import java.util.Date;class PrintStreamDemo { public static void main(String[] args) { String str = "abc"; char[] chs = new char[str.length()]; str.getChars(0, str.length(), chs, 0); System.out.print(new Date()); // Printing objects System.out.println(new Date()); // date System.out.flush(); System.out.print(str); // String System.out.println(str); System.out.print(chs); // char[] System.out.println(chs); System.out.print(' '); // char System.out.println(' '); System.out.print(5); // int System.out.println(5); System.out.print(5L); // long System.out.println(5L); System.out.print(1.23f); // float System.out.println(1.23f); System.out.print(1.23); // double System.out.println(1.23); System.out.print(true); // boolean System.out.println(true); // flush stream and check if we got any errors from those // print() and println() calls if (System.out.checkError()) { System.err.println("Got errors printing"); System.exit(-1); } // can also 'write' to a print stream System.out.write('A'); byte[] b = new byte[str.length()]; str.getBytes(0, str.length(), b, 0); System.out.write(b, 0, b.length); System.out.close(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -