
read sentence and convert all the word into capital case like camelcase

Hi Friend,
Try the following code:
import java.util.*;
class ConvertWordsIntoUpperCase
{
public static String toCamelCase(String s){
String[] str = s.split(" ");
String newstring = "";
for (String ss : str){
String st=ss.substring(0, 1).toUpperCase() +ss.substring(1).toLowerCase();
newstring = newstring + st;
}
return newstring;
}
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter sentence: ");
String st=input.nextLine();
System.out.println(toCamelCase(st));
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.