I am getting further with my Property to let program, but i need help working out the above error, it happens when the user selects the option to delete a property from the text file.

The user is supposed to be able to enter in a number and that deletes the line that that number corresponds to.

if(i == 2)
            {
               try
               
               {            
               	   BufferedReader br=new BufferedReader(new FileReader("properties.txt"));
                   String line=null;
                   while ((line=br.readLine()) != null) 
                   {
                        String[] addy=line.split(",");
                        PropertyToLet ptl=new PropertyToLet(addy[0],addy[1],addy[2]);
                        v.addElement(ptl);
                   }        
                   System.out.println("\nEnter the line number of the property you wish to remove");
                    //its at this line the errors occurs
                   ln = Double.valueOf(br.readLine()).intValue();
                   v.removeElementAt(ln);                   
                   PrintWriter outFile = new PrintWriter(new FileWriter("properties.txt"));
                   for (int i=0; i<v.size(); i++) 
                   {
                        PropertyToLet obj = (PropertyToLet) (v.lastElement());
                        outFile.println(obj.getpc() + "," + obj.gethn() + "," + obj.getmr());      
                   }
                   outFile.close();
                }               
                catch(ArrayIndexOutOfBoundsException aioobe)
                {
                    System.out.println("An Error Has occurred");   
                }
                catch(IOException ex)
                {
                    ex.printStackTrace();
                }
                
            }

The delete section works when i replace the line

ln = Double.valueOf(br.readLine()).intValue();

with

ln=2

i would use this if i could but the user needs to be able to select the line...

This question has already been answered. Start a new discussion instead.