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
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="";
}
}
}
}
{
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
Social Sciences,
7 months ago
Computer Science,
1 year ago
Physics,
1 year ago
Social Sciences,
1 year ago