Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    The current code will not all you to enter invalid data. Is that what you want it to do?

    Do you know how to code a try{}catch block to catch the error?
  2. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    The test does NOT make sense. userinput is an int variable and can ONLY hold int values.

    Have you removed that invalid and senseless statement, compiled the code, executed it and tried to enter...
  3. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    Comment out the invalid code, compile and execute the program and enter some invalid data to see what happens.


    int userinput = keyboard.nextInt();
    boolean hasInt = false;
    ...
  4. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    Have you tried executing the code and entering non-integer data? What happened?

    Hint: read the API doc for the nextInt() method.
  5. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    If its in the same program, continue here.
  6. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    I don't see any brackets with the for statements which is one place they should be.
  7. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    One problem I see with the code is the missing {} following each for statement. Always use {}s to surround the statements that are in the for loop.

    Also the code is not properly formatted. Nested...
  8. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    What is the format that you need? Give an example.

    One problem I see with the code is the missing {} following each for statement. Always use {}s to surround the statements that are in the for...
  9. Replies
    23
    Views
    1,459

    Re: Error displaying matrix?

    Please copy the full text of the error message and paste it here. It has important info about the error.

    Please edit your post and wrap your code with code tags:


    <YOUR CODE HERE>

    to get...
Results 1 to 9 of 9