Nicola Garofalo

Ranch Hand
+ Follow
since Apr 10, 2010
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nicola Garofalo

I've just seen another mistake

you write

Remember that you should catch an exception in a way like:

10 years ago
current e scanner are duplicate variables.

is not

Remove this first issues and go on.
10 years ago

i have put SQL Driver.tar in classpath.

What is the exact name of the driver you put in your classpath?
Let me know if it works.

Anyway that's mysql tutorial link on connecting to mySql using DriverManager
the problem should be here


let's say you created a schema named mydb, the connection string must be

Probably you can't, within the same Statement, execute select queries and batch updates.
11 years ago
I tried it and it works...
11 years ago

you are welcome
11 years ago
Line 23 was a while and now it's an if. Put the while back

11 years ago
Could you please post the code as it is now?
11 years ago
No, you won't

Did you make all the changes i told you ?
11 years ago
You did not make all the changes i asked you to make.

1) Remove from line 14 to line 16
2) In line 18 you must read the String returned by method KbdInput.readString()

3) Remove line 19, or you will miss some tokens
11 years ago
Last thing.

Remove lines

in your main method of class Grades, because method readString() does it too, and you would end up to read two lines
11 years ago
KbdInput.readInt() method could lead you to a runtime exception
It reads a line and it assumes this line will be an integer.

You could delete it and remove all the instructions

A nice method in KbdInput is readString() that returns a String that you can tokenize

Assuming that a user will enter values 60 70 40 30 -99 (but you should check user input token by token)

method readString() will return the String "60 70 40 30 -99"

You can tokenize that String with StringTokenizer

int variable input could become, for example

the inner loop

it's useless and you should remove it.

Start to make this changes and see what's happening
11 years ago
First of all.
We should know what KbdInput class does, in particular one of its methods, readInt().
it does not return an int as expected but an empty String


You create a StringTokenizer of the String taken as input, i.e. String line

But you don't go through its tokens!!!
So the loop

will probably never end

Can you post KbdInput.readInt() method?
11 years ago