Then create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to:

Get a String from the user at the command line

Populate an ArrayList of Character data (the wrapper class), with each char in the String represented as a separate Character element in the ArrayList

Output each Character to the command line, each on a separate line

Respuesta :

Answer:

See the explanation section

Explanation:

import java.util.*;

//The above statement is to import the Scanner and ArrayList class

public class StringSlicer {

   public static void main(String args[]) {

   Scanner scan = new Scanner(System.in);

   System.out.println("Enter your string: ");

   String inputString = scan.nextLine();

   

   ArrayList<Character> stringList = new ArrayList<Character>();

   for(int i = 0; i < inputString.length(); i++){

           stringList.add(inputString.charAt(i));

       }

       

   for(Character letter: stringList){

           System.out.println(letter);

       }

   }

}