Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- File f = new File("sample.txt");
- Scanner in = null;
- try {
- in = new Scanner(f);
- }
- catch (Exception e) {
- }
- List<Integer> array = new ArrayList<Integer>();
- while (in.hasNext()) {
- array.add(new Integer(in.next()));
- }
- System.out.println(array);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement