Results 1 to 2 of 2
  1. #1
    baltimore is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Error: ')' expected

    Hi, I'm writing a Java application. 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:
    Java Code:
    "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:
    Java Code:
    imaginary.addition(int a1,int b1,int a2,int b2);
    In the imaginary class, I implement the addition method like follows:

    Java Code:
    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.

  2. #2
    mathias is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default

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

Similar Threads

  1. Identifier expected error
    By vasu18 in forum New To Java
    Replies: 1
    Last Post: 01-01-2008, 05:49 PM
  2. Error: <identifier> expected
    By barney in forum AWT / Swing
    Replies: 2
    Last Post: 07-31-2007, 07:38 AM
  3. Error: '{' expected
    By romina in forum New To Java
    Replies: 1
    Last Post: 07-26-2007, 09:34 AM
  4. My error is: ')' expected
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-18-2007, 04:49 PM
  5. MSG ERROR: : expected
    By Marty in forum New To Java
    Replies: 1
    Last Post: 05-31-2007, 02:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •