Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 HELP!!! I got NULL!
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nogardreyals




PostPosted: Sun Jun 14, 2009 2:59 pm   Post subject: HELP!!! I got NULL!

void readerwriter ()
throws java.io.IOException
{
String input;
boolean higher;
int number = 0;
FileReader fra = new FileReader ("ProjectData.txt");
BufferedReader bfra = new BufferedReader (fra);
do
{
for (int count = 0 ; count < bfra.readLine ().length () ; count++)
{
if (Character.isDigit (bfra.readLine ().charAt (count)) == true) //basically, im trying to look at my txt file one line at a time, and looking for a number one char at a time
{
number = (int) bfra.readLine ().charAt (count);
}
}
}
while (bfra.readLine () != null);
fra.close ();
//

This is a part of a method i used.

I cannot run this part because the bolded segnment gets:
java.lang.NullPointerException
at GameMethods.readerwriter(GameMethods.java:427)
at FinalProjectMain.main(FinalProjectMain.java:18)

I do not know why. Can anyone help?
Sponsor
Sponsor
Sponsor
sponsor
McKenzie




PostPosted: Sun Jun 14, 2009 7:22 pm   Post subject: RE:HELP!!! I got NULL!

Each time you bfra.readLine () it reads a new line so your for loop, your if, and your assignment are three different lines.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: