Java基础----System.in、System.out

来源:互联网 发布:淘宝站外活动销量 编辑:程序博客网 时间:2024/05/24 04:44

package com.cug.datastream;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class SystemInDemo {public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String line = null;System.out.println("Please enter a String:");    line = br.readLine();    System.out.println(line);        System.out.println("Please enter a int:");    line = br.readLine();    int value = Integer.parseInt(line);    System.out.println(value);}}

package com.cug.datastream;import java.io.BufferedWriter;import java.io.IOException;import java.io.OutputStreamWriter;import java.io.PrintStream;public class SystemOutDemo {public static void main(String[] args) throws IOException {//PrintStream ps = System.out;//ps.println("safdas");//ps.close();BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));bw.write("dfsafd");bw.newLine();bw.write("I Love you!!!");bw.flush();bw.close();}}



0 0
原创粉丝点击