Ask Question

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

+3
Answers (1)
  1. 16 March, 14:26
    0
    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 stringList = new ArrayList ();

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

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

    }

    for (Character letter: stringList) {

    System. out. println (letter);

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Then create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to: Get a String from the user at ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers