# problem with illegal start of expression methdo

• 12-15-2011, 05:29 PM
lathspell
problem with illegal start of expression methdo
Hi, im writting a program for rational numbers and im having problem while calling for methods. 2 errors appear:
-error: illegal start of expression
-error: ')' expected
on line 42.
This is my very first post so please tell my if I do something wrong!

Code:

```package rational; import java.util.*; class Rational {               Scanner scan = new Scanner(System.in);                 private int nominator;                 private int denominator;                 public Rational(int up, int down){                         if (down == 0) throw new IllegalArgumentException();                         nominator = up;                         denominator = down;                 }                 public Rational(){                 System.out.println("Please, type numerator of rational");                 nominator = scan.nextInt();                 System.out.println("Please, type denominator of rational");                 denominator = scan.nextInt();                 Rational num = new Rational(nominator, denominator);                 System.out.println("This is your rational number:" + num);                 }                 public Rational (double d){                         int pow = 1;                         while(d -(int)d != 0){                                 pow *= 10;                                 d *= 10;                         }                 }         public static void main(String[] args){                         addition(Rational arg);                 }                 public Rational addition(Rational arg)                 {                         System.out.println ("ADDITION");                         nominator = (nominator*arg.denominator)+(arg.nominator*denominator);                         denominator = denominator*arg.denominator;                         Rational added = new Rational (nominator, denominator);                         return added;                 }                 public Rational multiplication(Rational arg)                 {                         System.out.println ("MULTIPLICATION");                         nominator = nominator*arg.nominator;                         denominator = denominator*arg.denominator;                         Rational multiplied = new Rational (nominator, denominator);                         return multiplied;                 }         public Rational subtraction(Rational arg)                 {                         System.out.println ("SUBTRACTION");                         nominator = (nominator*arg.denominator)-(arg.nominator*denominator);                         denominator = denominator*arg.denominator;                         Rational subtracted = new Rational (nominator, denominator);                         return subtracted;                 }                 public Rational division(Rational arg)                 {                         System.out.println ("DIVISION");                         nominator = nominator*arg.denominator;                         denominator = denominator*arg.nominator;                         Rational divised = new Rational (nominator, denominator);                         return divised;                 } }```
• 12-15-2011, 06:29 PM
Norm
Re: problem with illegal start of expression methdo
Please post the full text of the error message as written by the compiler. The message has information about the error that you have left out of your post.

Your error could be in passing an argument to a method. You should only code the name of the variable, not its type.