| | |
NullPointerException: null (in sun.misc.Floating Decimal) Error?
Thread Solved |
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.
The user is supposed to be able to enter in a number and that deletes the line that that number corresponds to.
Java Syntax (Toggle Plain Text)
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
with
i would use this if i could but the user needs to be able to select the line...
Java Syntax (Toggle Plain Text)
ln = Double.valueOf(br.readLine()).intValue();
with
Java Syntax (Toggle Plain Text)
ln=2
i would use this if i could but the user needs to be able to select the line...
![]() |
Other Threads in the Java Forum
- Previous Thread: Deleting user specified lines from a text file
- Next Thread: please help?
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows





