Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Problem referencing array from another class 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 referencing array from another class" Watch "Problem referencing array from another class" New topic
Author

Problem referencing array from another class

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40
I have an array in a jdbc class file.
But I can't reference it in another class file in the same package.


Here's my jdbc connection class code



and further down (in the same file )I have



in another file called file2.java, I tried to reference the array in the above file using the following...



I've got null printed.

I don't know what I've missed...

[ October 17, 2004: Message edited by: Parka Teoh ]
[ October 17, 2004: Message edited by: Parka Teoh ]

Do you have a parka?<br /> <br /><a href="http://sg.geocities.com/inschooool" target="_blank" rel="nofollow">Visit my homepage</a> | <a href="http://parka.deviantart.com/" target="_blank" rel="nofollow">Parka Deviantart gallery</a>
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Parka,
Is the System.out.println() writing at least once? Maybe the query isn't returning any data.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40
I've tried System.out.println in the connection file too. And the queries were printed out correctly. I have 9 items, and all the 9 items were displayed.

But somehow when I run the other java file to reference the array from the connection file, it returns null.

hmmm...

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Parka,
Since we've established this isn't a JDBC problem, I'm moving it to Java In General. The people who hang out there know a lot about the language itself and can be more helpful.
 
 
subject: Problem referencing array from another class
 
Similar Threads
What's the difference between return and return()
Stored proc not found...
Problems reading from a .txt file
How to return an array and display them?
Question about Mock Exam 2