Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem referencing array from another class

 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34378
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parka,
Is the System.out.println() writing at least once? Maybe the query isn't returning any data.
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34378
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic