![]() |
| ||
| getting nullpoint exception again
|
| ||
| Re: getting nullpoint exception again The exception contains a line number, so which line is it? |
| ||
| Re: getting nullpoint exception again
|
| ||
| Re: getting nullpoint exception again And which line there is line 29? |
| ||
| Re: getting nullpoint exception again
|
| ||
| Re: getting nullpoint exception again n[] is new array, has nothing in it. So n[i] has nothing in it for all values of i, so n[i].someFunction tries to call someFunction on a null value -> Exception. Maybe initialise n[i] to new Student1() before using it? |
| ||
| Re: getting nullpoint exception again
|
| ||
| Re: getting nullpoint exception again
|
| ||
| Re: getting nullpoint exception again NPE is probably because max isn't defined or initialised. But you have other problems.eg: S2 is initialised to empty Strings, but you never put anything else in there before comparing them. And you compare them alphabetically, not by length. Have a look at the split(" ") method for Strings - this will get you your words just like you need them... EDIT: I just saw that you have already posted this problem, and a number of other posters have given the same advice already, and you don't seem to have followed it. Are you wasting my time? |
| ||
| Re: getting nullpoint exception again [code] i am sorry i wanted to do it in my way. I know and remember other posts.But if you could solve the NPE problem in one case u could do it in other as well. I know the split or String tokenizer method. (i am tryng to explain for loop to one of my friend so i just took a chance if u could solve it.But its ok. sorry again . thanks akulkarni |
| All times are GMT -4. The time now is 6:01 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC