标签:ring class 引入 ext public line print input eof
# Scanner 类(慢)
1 import java.util.Scanner;//引入Scanner类 2 import java.io.BufferedInputStream; 3 import java.io.BufferedOutputStream; 4 public class run { 5 public static void main(String args[]) { 6 Scanner cin=new Scanner(System.in);//input名字可以取任意合法的 7 Scanner sc = new Scanner (new BufferedInputStream(System.in));//可以加速 8 byte x=cin.nextByte(); 9 boolean f=cin.nextBoolean(); 10 int a=cin.nextInt();//输入整数 11 short b = cin.nextShort(); 12 long c=cin.nextLong(); 13 float d=cin.nextFloat(); 14 double e=cin.nextDouble(); 15 String str=cin.nextLine();//读入字符串 16 while(cin.hasNext()){//相当于while(scanf()!=EOF) 17 break; 18 } 19 20 System.out.printf("%d",a); 21 } 22 }
# BufferedInputStream
标签:ring class 引入 ext public line print input eof
原文地址:https://www.cnblogs.com/hhyx/p/12381096.html