I need to design and implement an application that reads a string from the user and prints it one character per line.

import java.util.*;
import java.text.*;

public class EveryLine5
{
    //----------------------------------------------------------------------------------------------
    //  Reads in a string.
    //----------------------------------------------------------------------------------------------
    public static void main (String[] args)
    {
        int length;
        char current;
        String msg = "user input";

        Scanner scan = new Scanner(System.in);
        System.out.println ("Enter a string: ");
        msg = scan.nextLine();
        length = msg.length();

        for (int count = 0; count < length; count++)
        {
            current = msg.charAt(count);
            System.out.println (current);
            count++;
        }
    }
}

and the code you have doesn't work?

You execute two count++ per iteration of the loop, that's one too many.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.