Untitled
unknown
java
3 years ago
526 B
7
Indexable
Scanner scanner = new Scanner(System.in); System.out.println("How many elements do you want to input?"); int arraySize = scanner.nextInt(); ArrayList<String> inputList = new ArrayList<>(); for(int i = 0; i < arraySize; i++){ System.out.println("Input String"); inputList.add(scanner.next()); } System.out.println("You have inputted all the strings. The result is: "); for(String value: inputList){ System.out.println(value); }
Editor is loading...