java io 模板

java io流模板
import java.io.BufferedReader;  
import java.io.IOException;  
import java.io.InputStream;  
import java.io.InputStreamReader;  
import java.io.PrintWriter;  
import java.util.Scanner;  
  
public class Main {  
  
    static InputReader in;  
    static PrintWriter out;  
  
    public static void main(String[] args) throws IOException {  
        in = new InputReader(System.in);  
        out = new PrintWriter(System.out);  
        /*
         * 
         * 这里补充你的实际代码   读取输入采用   in.nextInt();的形式
         * 
         * */
        out.close();  
    }  
  
    static class InputReader {  
        BufferedReader br;  
  
        public InputReader(InputStream stream) {  
            br = new BufferedReader(new InputStreamReader(stream));  
        }  
  
        public int nextInt() throws IOException {  
            int c = br.read();  
            while (c <= 32) {  
                c = br.read();  
            }  
            boolean negative = false;  
            if (c == '-') {  
                negative = true;  
                c = br.read();  
            }  
            int x = 0;  
            while (c > 32) {  
                x = x * 10 + c - '0';  
                c = br.read();  
            }  
            return negative ? -x : x;  
        }  
  
        public long nextLong() throws IOException {  
            int c = br.read();  
            while (c <= 32) {  
                c = br.read();  
            }  
            boolean negative = false;  
            if (c == '-') {  
                negative = true;  
                c = br.read();  
            }  
            long x = 0;  
            while (c > 32) {  
                x = x * 10 + c - '0';  
                c = br.read();  
            }  
            return negative ? -x : x;  
        }  
  
        public String next() throws IOException {  
            int c = br.read();  
            while (c <= 32) {  
                c = br.read();  
            }  
            StringBuilder sb = new StringBuilder();  
            while (c > 32) {  
                sb.append((char) c);  
                c = br.read();  
            }  
            return sb.toString();  
        }  
  
        public double nextDouble() throws IOException {  
            return Double.parseDouble(next());  
        }  
    }  
}  


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值