| Author |
Starting to open the connection at the beginning of the class
|
Nico Yukiko
Greenhorn
Joined: Aug 24, 2005
Posts: 21
|
|
How come i can't place the try at the start of a new class and the code below is giving me a problem.and regarding declaring an array to store the info in the database to replace the static code at the bottom is also giving problem. [edited to add code tags] [ August 24, 2005: Message edited by: Jeanne Boyarsky ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
Basic Java. All executable statements must be within a method.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Nico Yukiko
Greenhorn
Joined: Aug 24, 2005
Posts: 21
|
|
|
But how can i separate the code into a method and then call the method
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26218
|
|
Nico, Welcome to JavaRanch! I'm guessing you want to run this as a standalone program. In that case, add the line: before the first "try {". And then close the brace with a } at the end of the code. To call it, you can then do "java Catalog" from the command line.
|
[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
|
 |
Nico Yukiko
Greenhorn
Joined: Aug 24, 2005
Posts: 21
|
|
|
But how can i store the information retrieve from the database into an array so that i can create a new catalog item base on the array
|
 |
Stephen Boston
Ranch Hand
Joined: Jul 14, 2005
Posts: 165
|
|
You may want to check out ArrayList. LearnJDBC
|
Steve<br /> <br />No matter where you go, there you are.<br /> <br />"My evil self is at the door, and I have no power to stop it."
|
 |
 |
|
|
subject: Starting to open the connection at the beginning of the class
|
|
|