I want user input of an array of integers without explicitly mentioning the array-size. It should be just like command line arguments, i.e. if we want to access the length of the string array (String args[]) we use "args.length", we can also perform other string array functions on it.
We always first ask the user the number of inputs he'd give and then ask for the inputs. But I directly want to ask for the array element inputs. What I have already tried is: I asked for the input and instructed the user to enter a special character...let's say full stop "." after he is done enter the elements of array. Then I used conditional statements to check id he entered "." and stopped taking user input. Thus I had an array, but I always had to make the user enter "." to terminate the process of taking inputs.
ArrayListorLinkedList.is one way, others are an empty string, i.e. the user press enter/return without entering anything. Ctrl-d is also commonly used to end input, but it could be difficult if you are using aScanner.