Question: 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

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

Note:

Use an ArrayList where each element is a char. Declare the ArrayList in main.

The use of three methods is required.

The first method has no parameters and returns a string.

It prompts the user for a string and returns the string to main.

The prompt and read should be in the method (not main).

The second method has two parameters, the string from the first method and the ArrayList (which you are going to fill in). Use a for loop to go character by character through the string (charAt method).

Store each of the characters in the ArrayList using the add method.

The third method has the ArrayList as a parameter.

Use a for loop to printout each of the elements in the ArrayList using the get method.

An example run:

Enter a string:

rabbit

r

a

b

b

i

t

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!