Here is what I have so far...
import java.util.Scanner;
public class tst
{
public static void main (String [] args)
{
Scanner stdIn = new Scanner(System.in);
String sentence = "This is the test.";
char response; // user's y/n response
int ctr = 65;
do
{
System.out.print ("Would you like to see a do-while loop execute? (y/n): ");
for(ctr = 0; ctr < sentence.length(); ctr++);
{
System.out.println(sentence.charAt(ctr));
}
response = stdIn.next().charAt(0);
} while (response == 'y' || response == 'Y');
} // end main
} // end class tst
I'm trying to get the program to print out the value of sentence one character per line using the for loop within the do-while loop after the user answers y or Y to the query.
Please help. I appreciate the help in advance.
EDIT: I tried to switch the response input below the question presented to the user and when I run the Java Application I get prompted with the question but run into a mess when I answer y.