This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes help with global 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
Reply locked New topic
Author

help with global array

Jeff Yan
Ranch Hand

Joined: Nov 05, 2009
Posts: 42
Hey all, im having a little trouble. basically im reading an array of integers from a file and putting it into a linked list, then from the linked list im transfering it to an array using the .toArray() method of the arrayList methods. the array is filled with the data, but when i call another method to display the array it is coming up with a null pointer error. ive used System.out.println to test it and the array is of the correct size, and with the correct data in it in the method that reads the data into it, but outside of it the array is "empty" even though it is a global array?! it compiles absolutly fine but with a unsafe operation warning but that is not the issue. my code is below! much appriciated. Jeff.



~ Jeff Yan ~
Embla Tingeling
Ranch Hand

Joined: Oct 22, 2009
Posts: 237
Doubleposted,

http://www.coderanch.com/t/471019/Beginning-Java/java/Global-Array-not-working-please
Jeff Yan
Ranch Hand

Joined: Nov 05, 2009
Posts: 42
because nobody was answering it! sorry, i was getting frustrated with it
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

Then you should ask again for an update in the existing thread, but not within 24 hours. As for creating this thread, use one thread per question. Closing this one.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: help with global array
 
Similar Threads
reading a user chosen file into array - multiple files
Global Array not working
Overhead IO : The cryptic case of the extra bytes
reading a user chosen file into array
Currency Problem + General Advice