Java String Program - Part 1
Program 1 Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string. Sample input: we are in cyber world Sample output: We Are In Cyber World import java.util.Scanner; class P1{ public static void change(){ Scanner sc = new Scanner(System.in); System.out.println("Enter a sentence"); String s = sc.nextLine(); String newstr = ""; s = s.toLowerCase(); s = s.trim(); s = " " + s; for(int i=0; i<s.length(); i++){ char ch = s.charAt(i); if(ch == ' '){ ...