I have text file with constant elements in line but variable number of lines... text file looks like
asdf 12 54 12
brjk 45 2 14
etc..
I want to make array from this file. Can you help me with my code? This not working..
Expand|Select|Wrap|Line Numbers
- String[] part = new String[5];
- BufferedReader f = null;
- try{
- f = new BufferedReader(new FileReader(filename));
- String something=null;
- while((something=f.readLine())!=null){
- part = something.split(" ");
- System.out.print(part[0]);
- }
- } catch (IOException ex) {
- Logger.getLogger(Hlavni.class.getName()).log(Level.SEVERE, null, ex);
- }
all comments are appreciated..