Created
June 7, 2012 20:06
-
-
Save rahul-rkt/2891252 to your computer and use it in GitHub Desktop.
New way of reading files in Java 1.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test.file.reading; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.Scanner; | |
public class NewJava { | |
public static void main(String[] args) throws IOException { | |
System.out.println("" + new Scanner(new File("test.txt")).useDelimiter("\\Z").next()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment