All pastes #219460 Raw Edit

Untitled

public text v1 · immutable
#219460 ·published 2006-10-24 18:29 UTC
rendered paste body
public void AddCar (String name) throws IOException
    {
        int count = 0;
        String [] CarArr = new String [20];
        try
        {
            BufferedReader in = new BufferedReader (new FileReader ("Cars.txt"));
            PrintWriter out = new PrintWriter (new FileWriter ("Cars.txt."));
            String line = in.readLine ();
            while (line != null)
            {
                CarArr [count] = line;
                count++;
                line = in.readLine ();
            }
            in.close ();


            count++;
            CarArr [count] = name;

            for (int i = 0 ; i < (CarArr.length) ; i++)
            {
                if (CarArr [i] == null)
                {
                }
                else
                {
                    System.out.println (CarArr [i]);
                    //out.println ((Arr [i]));
                }
            }
            out.close ();
        }
        catch (FileNotFoundException e)
        {
        }
    }