Friday, April 5, 2013

File Path in NetBeans


"./



/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MaxSub;

/**
 *
 * @author attzdy1
 */
import java.util.Scanner;
import java.util.Formatter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

import java.util.ArrayList;
public class MaxSub {
 
    /**
     * @param args the command line arguments
     */
    public static void main (String [] args) throws IOException {
     
     
        Scanner in = new Scanner(new File("./src/input.txt"));        // file input
        Formatter out = new Formatter(new File("./src/output.txt"));  // file output
     
        ArrayList<Integer> a = new ArrayList<Integer>();
        while(in.hasNext()){
            a.add(in.nextInt());
        }
        out.format("%s\n", a.toString());  // format() has the same syntax as printf()
        //Algorithm
     
     
        out.close();    // flush the output and close the output file
        System.exit(0); // likely needed in USACO
    }
}

No comments:

Post a Comment