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...
Type: Posts; User: Norm
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...
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...
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...
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?
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...
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.
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...