Search:

Type: Posts; User: javapenguin

Search: Search took 0.11 seconds.

  1. Replies
    14
    Views
    1,891

    Re: Simple error can't figure out.

    System.out.println("Enter your value(s).");
    for (int n = 0; n < array.length; n++)
    {
    array[n] = console.nextInt();
    }



    this is going to ask the user to...
  2. Replies
    14
    Views
    1,891

    Re: Simple error can't figure out.

    Wouldn't the methods in the first class have to be static too to be used in the main method of the second class? I thought static methods could only call other static methods.

    Maybe I'm wrong.
  3. Replies
    14
    Views
    1,891

    Re: Simple error can't figure out.

    You have dividend set to 0. What if you called getDivide()?



    sqroot = Math.sqrt(getDivide());

    return(sqroot);

    and in getDivide()
  4. Replies
    14
    Views
    1,891

    Re: Simple error can't figure out.

    I think the Math class returns a double.


    Try casting it to an int:

    sqroot = (int) Math.sqrtrt(dividend);

    I think it needs a () around the word int, but try {} if it doesn't work.

    or...
Results 1 to 4 of 4