Search:

Type: Posts; User: Norm

Search: Search took 1.29 seconds.

  1. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    No they are put on the command line with the java command and the class name as you've shown in your posts. If there aren't any args passed to the main() method, then the program will have to ask the...
  2. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    Have you read the API doc for the Scanner class to see what methods to use for reading Strings from a user's input? The method you are using only tests if input is available.
    Do you want to read a...
  3. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    What happens when you execute the code?
    It looks like it prints out a message and waits for the user to enter something.

    Is the program supposed to read something from the user?

    What do want...
  4. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    Can you explain what "doesn't work" means?
    What does the code do when you execute it?
    What do you want it to do differently?

    What is the posted code supposed to do?
  5. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    What you posted looks like for the user giving the program input on the command line where the args on the command line are passed to the main() method.

    If you want to prompt the user for input...
  6. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    If there is no first element at index 0, the array must have a size of 0. The code needs to test the array's length before trying to index into the array with an invalid index.
  7. Re: There's an arrayoutofbounds, but my partner coded this and he doesn't know whats wrong.

    You forgot to post the full text of the error message and the code where the error happens.

    An arrayoutofbounds error happens when the index to an array goes past the end of the array.
    Remember...
Results 1 to 7 of 7