So i did my code, he asks for the string then i put it, then he tells me what string i put in but for some reason i dont understand he doesnt show the capitalized first letter for each word coverted string.

Here is my code:

public class LerString {
public static void main(String[] args) {
boolean stop;
do {
System.out.println("Enter your string");
BufferedReader si = new BufferedReader(
new InputStreamReader(;
String s = null;
try { s = si.readLine(); }
catch(IOException e) { System.out.println("error"); }
System.out.println("You Entered " +s);

stop = s.equals("stop it");


static void printCapitalized(String s) {
char ch;
char prevCh;
prevCh = '.';
for ( int i=0 ;  i < s.length();  i++ ) {
ch = s.charAt(i);
if ( Character.isLetter(ch)  &&  ! Character.isLetter(prevCh) )
System.out.print( Character.toUpperCase(ch) );
System.out.print( Character.toLowerCase(ch) );
prevCh = ch;


Any Ideas would be much appreciated


Well, you do not call the printCapitalized() method anywhere in your main method, so it's not going to do anything until you call it.

jup, nothing wrong with the code, and it's doing all you've told it to do.