Scanner: hasNextLine()
import java.io.File;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception{
File file = new File("data.txt");
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
System.out.println(line);
}
}
}
Home
Java Book
Essential Classes
Java Book
Essential Classes
Scanner:
- Scanner
- Setting Delimiters
- findInLine( )
- findWithinHorizon( )
- skip( )
- new Scanner(FileReader file)
- new Scanner(InputStream source)
- Scanner: hasNext()
- Scanner: hasNextBoolean()
- Scanner: hasNextDouble()
- Scanner: hasNextInt()
- Scanner: hasNextLine()
- Scanner: next()
- Scanner: nextBoolean()
- Scanner: nextDouble()
- Scanner: nextInt()
- Scanner: nextLine()