自己在网上冲浪和自己整理,形成了一个Java快读模板;(会长期改进的,博主从c++转Java了,正在慢慢熟悉)
import java.io.*;
import java.util.*;class Read {StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));public int nextInt() throws Exception {st.nextToken();return (int) st.nval;}public long nextLong() throws Exception { st.nextToken();return (long) st.nval;}public double nextDouble() throws Exception {st.nextToken();return (double) st.nval;}public String nextString() throws Exception {return bf.readLine(); }public void close() throws Exception {bf.close();}// 使用空格分割字符串public String[] nextChars() throws Exception {String line = bf.readLine();String[] lines = line.split(" ");return lines;}
}public class Main {public static void main(String[] args) throws Exception {Read rb = new Read();System.out.println("读入一个字符串!!!!");String[] chars = rb.nextChars();for (String it : chars) {System.out.println(it);}System.out.println("读入一个int");int a = rb.nextInt();System.out.println("读入一个String");String b = rb.nextString();System.out.println("读入一个Double");Double c = rb.nextDouble();System.out.println("读入一个long");long d = rb.nextLong();System.out.println("读入一个字符");char tem = rb.nextString().charAt(0);System.out.println("关闭流");rb.close();return ;}
}