Computer Science, asked by choclatebrains, 1 year ago

input a sentence in java and convert the first character of each word into uppercase eg: india is big. output: India Is Big.

Answers

Answered by Tarun304
1
public class Convert
{
public void main(String s)
{
char ch=' ', c=' '; String w ="";
for(int I=0; I<s.length();I++)
{
ch=s.charAt(I);
if(ch!=' '&&ch!='.')
w+=ch;
else
{
c=w.charAt(0);
c=Character.toUpperCase(c);
System.out.print(c+w.substring(1)+" ");
w="";
}
}
}
}

Similar questions