Sign in to follow this  
Tigernado

[Java] Weird Error

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this