文件操作 package ch15; import java.io.*; /** * Created by Jiqing on 2016/12/28. */ public class FileTest { public static void main(String[] args) throws IOException{ // 以当前路径创建一个File对象 File file = new File("."); System.out.println(file.getName()); /
1.只输入一组数据: Scanner s=new Scanner(System.in); int a=s.nextInt(); int b=s.nextInt(); 2.输入有多组数据,没有说明输入几组数据,每组数据占一行: Scanner s=new Scanner(System.in); while(s.hasnext()){//判断是否数据结束 int a=s.nextInt(); int b=s.nextInt(); } 3.输入多组数据,第一行为一个整数N,表示有N组测试数据,后面的接