I want to use only charAt() and toUpperCase() function and capitalize the first letter of each word in a sentence.
Like make the letter capital, that is just after the space.
I tried with this following code.
     import java.util.Scanner;
class firstscap
       {
            public static void main(String args[])
            {
                Scanner sc=new Scanner(System.in);
                System.out.println("enter a sentence");
                String s=sc.nextLine();
                for(int i=0;i<s.length();i++)
                {
                      char c=s.charAt(i);
                      if(Character.isSpaceChar(c))
                      {
                        char ch=s.charAt(++i);
                        ch=ch.toUpperCase();
                      }
                 }
                 System.out.println(s);
               }
            }
 
     
     
     
     
     
    