• Java 应用


    I/O

    System.out is a PrintStream object that outputs to the screen.

    System.in is a InputStream object that reads from the keyboard.

    InputStream objects (like System.in) read raw data from some source(e.g keyboard network), but don't format the data.

    InputStreamReader objects compose the raw data into character (whick are typically two bytes long in Java)

    BufferedReader objects compose the characters into entire lines of text.

    import java.io.*;
    class SimpleIO {
        public static void main(String[] arg) throws Exception {
            BufferedReader keybd =
                new BufferedReader(new InputStreamReader(System.in));
            System.out.println(keybd.readLine());
        }
    }
    import java.net.*;
    import java.io.*;
    class Netease {
        public static void main(String[] arg) throws Exception {
            URL u = new URL("http://www.163.com/");
            InputStream ins = u.openStream();
            InputStreamReader isr = new InputStreamReader(ins);
            BufferedReader whiteHouse = new BufferedReader(isr);
            System.out.println(whiteHouse.readLine());
        }
    }
  • 相关阅读:
    EL表达式_1
    Servlet2
    Servlet1
    安装Tomcat
    Java日期时间3
    SpringCloud之Ribbon负载均衡
    SpringCloud之Eureka注册中心
    存储过程—增减字段
    880. Decoded String at Index
    977. Squares of a Sorted Array
  • 原文地址:https://www.cnblogs.com/whuyt/p/4666615.html
Copyright © 2020-2023  润新知