aspose file tools*
The moose likes Java in General and the fly likes Problem with reading txt file into 2d array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with reading txt file into 2d array" Watch "Problem with reading txt file into 2d array" New topic
Author

Problem with reading txt file into 2d array

Liana Norpunova
Greenhorn

Joined: Aug 24, 2010
Posts: 23
Hi Everyone!

I have a problem with reading data from the txt file into the 2d array. In general, the above code is workable. The only thing that doesn't work is: userdata[row][j] = tokens[j]; The problem is that my array "userdata" gets values "null". However, if I replace this code with "System.out.println(tokens[j]);", then I can see the values from the file "UserDataFile.txt". What is wrong in my code?

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4542
    
    5

And how is this a Swing / AWT / SWT / JFace question?


luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

It isn't. Off to Java in General we go!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Where do you define userdata? (It's harder to help when we don't have all the information.)
Liana Norpunova
Greenhorn

Joined: Aug 24, 2010
Posts: 23
Hi! I've already solved this problem. I just read from this array into JTable, and everything worked fine.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with reading txt file into 2d array