Results 1 to 3 of 3
  1. #1
    sivasayanth's Avatar
    sivasayanth is offline Member
    Join Date
    Dec 2007
    Posts
    20
    Rep Power
    0

    Default what is the probleam here?

    public static void main(String[] args) {
    double a = Double.parseDouble(args[0]);
    double b = Double.parseDouble(args[1]);
    double sum = a + b;
    double prod = a * b;
    double quot = a / b;
    double rem = a % b;

    System.out.println(a + " + " + b + " = " + sum);
    System.out.println(a + " * " + b + " = " + prod);
    System.out.println(a + " / " + b + " = " + quot);
    System.out.println(a + " % " + b + " = " + rem);

    System.out.println();
    System.out.println("sin(pi/2) = " + Math.sin(Math.PI/2));
    System.out.println("log(e) = " + Math.log(Math.E));
    }
    The out put is

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at Ex3.main(Ex3.java:21)

    Process completed.

    please help me?:confused:

  2. #2
    Join Date
    Dec 2007
    Posts
    24
    Rep Power
    0

    Default

    hey man ur using any tool or just in command screen ur running the code..
    in command screen means..
    u run as

    java <class name> <a //u hav 2 enter the number > <b //same way as a>
    and then compile ok
    and moreover u must catch the Exception in the program ok

  3. #3
    sivasayanth's Avatar
    sivasayanth is offline Member
    Join Date
    Dec 2007
    Posts
    20
    Rep Power
    0

Posting Permissions

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