Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Good luck.
  2. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Sorry, I don't like working with messed up code.
    Fix the formatting and put the user's input into the Scanner class's constructor as shown in post#14.

    I bet you could have fixed the formatting in...
  3. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    What does that mean? If I'm going to test the code, it matters to me.
  4. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Glad you got it working.
  5. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Where is the input to the program?
    Replace
    Scanner in = new Scanner (System.in);
    with
    Scanner in = new Scanner ("1/n2/n3/n4/n); //put valid user input in Scanner's constructor.


    The code...
  6. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    The normal way to search an array is with a loop with an if statement inside. Without seeing code that compiles and executes, I can't recommend much.
  7. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Can you make a small, complete program that compiles, executes and shows the problem for testing?
    Be sure to add what input the user needs to make to execute the program.
  8. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    That shows the first element of the array as 0.0. The array has no negative numbers.
  9. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Post the statement that has the error.

    If the array has two dimensions, use the Array class's deepToString() method.
  10. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    Print out its contents to be sure:

    System.out.println("an ID "+ java.util.Arrays.toString(theArrayName));
  11. Replies
    22
    Views
    1,384

    Re: something is wrong with if-statement?

    0 is higher than either of those numbers. Are there any 0s in the array?

    The code is very hard to read and understand because there are more than one statement on a line. Can you fix the code to...
Results 1 to 11 of 11