Java Scanner Read Line readLine(String path)

Here you can find the source of readLine(String path)

Description

read Line

License

Open Source License

Declaration

public static String readLine(String path) throws FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileNotFoundException;

import java.util.Scanner;

public class Main {
    public static String readLine(String path) throws FileNotFoundException {
        return readLine(new File(path));
    }/*  w  w  w  . j a v  a  2 s  .co m*/

    public static String readLine(File file) throws FileNotFoundException {
        Scanner input = new Scanner(file);
        String output = input.nextLine();
        input.close();
        return output;
    }
}

Related

  1. readLineByLine(String fileName)