Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

15.12. Scanner

		
Scanner input = new Scanner(new File("temp.txt"));
System.out.print(input.nextLine());		
		
		
		
package cn.netkiller.io;

import java.io.File;
import java.io.FileNotFoundException;
//import java.io.PrintWriter;
import java.util.Scanner;

public class PrintWriterTest {

	private static Scanner input;

	public PrintWriterTest() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) throws FileNotFoundException {
		// TODO Auto-generated method stub
		// PrintWriter output = new PrintWriter("temp.txt");
		// output.print("Welcome to Java!");
		// output.close();

		input = new Scanner(new File("temp.txt"));
		System.out.print(input.nextLine());
	}

}