The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

NullPointerException

Posted by Jonathan Marks on November 20, 2000 at 3:35 AM

Does anyone know why a NullPointerException might be thrown. I am trying to copy the details from an array into a text file using the following code;

try
{FileWriter fw = new FileWriter "C:\\Java_Files\\Customers_Java.txt");
PrintWriter pw = new PrintWriter(fw);

for (i = 1; i <= customers_held; i++)
{
pw.println(i);
pw.println(name[i]);
pw.println(street[i]);
pw.println(town[i]);
pw.println(county[i]);
pw.println(postcode[i]);
}
fw.close();
}catch(FileNotFoundException e){
System.out.println("Error: Can't find file specified!");
}catch(IOException e){
System.out.println("I/O Error: " + e);
}

Any help would be appreciated!
Many thanks




Replies:
  • Answer Gokulraj November 20, 2000 at 4:59 AM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us