Results 1 to 4 of 4
- 03-17-2012, 03:02 AM #1
scanning lines from notepad, by creating a loop "while(input_line=NULL) {"
thxJava Code:while(input_line!=null) { System.out.println("---------------"); System.out.println("Line No:"+TotalLineCount);//"TotalLineCount" is incremented after each line-scanning input_line =in.readLine(); input_line=input_line.replaceAll("\"",""); input_split = input_line.split(" "); System.out.println("Input Line:"+input_line); System.out.print(input_split.length); System.out.print("x"+input_split[0]); System.out.print("y"+input_split[2]); TotalLineCount++; //at the final line, it reaches the file-length. and the next line is null. //but the while loop continues.. cuz, input_line is present yet. //Thus I get an error during run-time "nullpointerexception" //Is there another looping technique? }
dhilip
- 03-17-2012, 03:10 AM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: scanning lines from notepad, by creating a loop "while(input_line=NULL) {"
while((input_line=in.readLine()) !=null)
then you can delete line 7.
- 03-17-2012, 03:15 AM #3
Re: scanning lines from notepad, by creating a loop "while(input_line=NULL) {"
- 03-17-2012, 03:19 AM #4
Re: scanning lines from notepad, by creating a loop "while(input_line=NULL) {"
Similar Threads
-
loop "play again" in an 8 ball game , loops but wont let me answer my "out.print"
By IareSmart in forum New To JavaReplies: 1Last Post: 02-01-2012, 08:37 PM -
My nextint() is causing "symbol not found" The string lines run fine. Please help.
By naterptater in forum New To JavaReplies: 9Last Post: 08-03-2011, 05:05 PM -
An "if" statement inside a "for" loop?
By soccermiles in forum New To JavaReplies: 18Last Post: 04-20-2010, 03:44 AM -
Count lines cointaining "word" in input file
By gwithey in forum New To JavaReplies: 5Last Post: 04-02-2009, 05:23 AM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks