null pointer exception

hi am getting null pointer exception in my code,

can anybody explain as why,

try{

FileReader fread =new FileReader("DIS.txt");

BufferedReader bread =new BufferedReader(fread);

int i=0;

do{

text = bread.readLine();

val[i] = text;

i++;

}while(text !=null);

bread.close();

System.out.println("raech");

for(int j=0;j<3900;j++){

System.out.println("value is"+val[i] );

}

}catch(Exception e){

e.printStackTrace();

// System.out.println ("IO exception =" + e );

}

[1226 byte] By [prasadgunasa] at [2007-11-27 8:32:10]
# 1
Why didn't you stay with the same thread?Also, the full error message and an indication in the code of which line it is referencing would be helpful.Edit: Although from that code I would first hazzard to guess that it has to do with either text or val.
masijade.a at 2007-7-12 20:27:55 > top of Java-index,Java Essentials,Java Programming...
# 2
Where are you getting the NPE? Please specify the line, we don't have ESP.
nogoodatcodinga at 2007-7-12 20:27:55 > top of Java-index,Java Essentials,Java Programming...
# 3
this is the error message coming while running the code,java.lang.NullPointerExceptionat sort.readfile(sort.java:17)at sort.main(sort.java:38)
prasadgunasa at 2007-7-12 20:27:55 > top of Java-index,Java Essentials,Java Programming...
# 4
> this is the error message coming while running the> code,> > java.lang.NullPointerException> at sort.readfile(sort.java:17)> at sort.main(sort.java:38)And which line is line number 17?
masijade.a at 2007-7-12 20:27:55 > top of Java-index,Java Essentials,Java Programming...
# 5
thanks,the error is i dint initialize the array size for the string[] val;now its k;
prasadgunasa at 2007-7-12 20:27:55 > top of Java-index,Java Essentials,Java Programming...