Check out example codes for "capitalize string java". It will help you in understanding the concepts better.

Code Example 1

String str = "hello world!";

// capitalize first letter
String output = str.substring(0, 1).toUpperCase() + str.substring(1);

// print the string
System.out.println(output);
// Hello world!

Code Example 2

String str = "java";
String cap = str.substring(0, 1).toUpperCase() + str.substring(1);
// cap = "Java"

Learn ReactJs, React Native from akashmittal.com