PDA

View Full Version : Java Compile Time Error Message


mrprimo55
05-12-2005, 02:34 AM
I'm writing a Java application in Metrowerks Codewarrior. The program utilizes methods in classes separate from the main class. When I try to run it, I get an error. This is the error: "Error: ')' expected." The code that it points to is the place where I call the methods from inside a switch() statement. It cites 4 different examples but they are all the same, just different method names. Here is just one of the ones that it finds the error with:
imaginary.addition(int a1,int b1,int a2,int b2);
In the imaginary class, I implement the addition method like follows:
public void addition(int a1,int b1,int a2,int b2)

I can't understand what the error is asking for. Everything seems fine to me. Could someone please help me out with what it wants? If you need the whole code just let me know and I will readily post it. Thanks for your help.

squirellplaying
05-12-2005, 04:03 AM
Try:
imaginary.addition(a1,b1,a2,b2);

or
imaginary.addition((int)a1,(int)b1,(int)a2,(int)b2); if you want to cast them as ints.

mrprimo55
05-12-2005, 04:04 AM
Try:
imaginary.addition(a1,b1,a2,b2);

or
imaginary.addition((int)a1,(int)b1,(int)a2,(int)b2); if you want to cast them as ints.

Well they are already ints so I shouldn't have to cast them. hmmm

mrprimo55
05-12-2005, 04:10 AM
Try:
imaginary.addition(a1,b1,a2,b2);

or
imaginary.addition((int)a1,(int)b1,(int)a2,(int)b2); if you want to cast them as ints.

Ya I tried this and it worked. Guess I only have to define them as ints in the imaginary class. Thanks for your help! imaginary.addition(a1,b1,a2,b2);