⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printstreamdemo.java

📁 这个都是一些Java的IO相关的一些源码
💻 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 + -