Ask Question
5 November, 10:04

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

+5
Answers (1)
  1. 5 November, 12:43
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers