| Author |
about read() method in filereader class
|
Jian Zhang
Greenhorn
Joined: Aug 30, 2003
Posts: 20
|
|
|
I have use the read method in the filereader class to read into a char [],and it returns the number of character have been read. Now I want to read the file in a 2D array. No way to use the same method because the read() method doesn't accept 2d array, and I don't want to the array has any empty contents(since java can't let you change dynamically the length of array).Help please!
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8290
|
|
|
a 2d array is probably a bad choice for storage when reading in from a file since you don't know how many read operations you will be performing. Try one of the collections that grow when you add something to it (java.util.ArrayList, for example).
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Jian Zhang
Greenhorn
Joined: Aug 30, 2003
Posts: 20
|
|
|
sorry but this is the requirement of the teacher , this is my course work ,hehe. I have to use 2d array
|
 |
 |
|
|
subject: about read() method in filereader class
|
|
|