[Java] Weird Error
I'm working on a simple Java program far a class, but I'm being held up by this error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Checkbook.myCheckbook cannot be resolved to a type
Syntax error on token ";", . expected
the error is from this block of code:
Checkbook myCheckbook = new Checkbook; // Here it says Checkboon.myCheckbook
// cannot be resolved to a type
myCheckbook.createCheck("Mac",10.0,6,3,2007);
myCheckbook.createCheck("sue", "Grass cutting
Checkbook is in its own file, along with the rest of the project with no errors. So does anyone have an idea where this error is coming from?
P.S. Also..I need to know how to post code the correct way
Hmm.. the call to create the new CheckBook object should be:
Checkbook myCheckbook = new Checkbook(); // brackets important
Of course, if the constructor needs parameters, you should put them in the brackets.
Hope this helps,
poss
Checkbook myCheckbook = new Checkbook(); // brackets important
Of course, if the constructor needs parameters, you should put them in the brackets.
Hope this helps,
poss
Doh, should of known that from C# lol, I have another error, but I think it just deals with an out of bounds array...I'll edit this post if I can't fix it.
Quote:Original post by Tigernado
Doh, should of known that from C# lol,
Hate it when I spend hours trying to track down a bug, when it's something simple like that.
Been there, done that, tore the T-shirt in frustration.
poss.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement