jQuery in Action, 2nd edition*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 4523
    
    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: 19656
    
  18

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with reading txt file into 2d array
 
Similar Threads
Adding 2-d ArrayList to JTable
Updating a file from an object (ArrayList)
Vectors within vectors
Error printing out from a read in file.
How to export 2D Array to a FIle