1String str = "hello world!";
2
3// capitalize first letter
4String output = str.substring(0, 1).toUpperCase() + str.substring(1);
5
6// print the string
7System.out.println(output);
8// Hello world!
9
1string s="hello";
2s = Character.toUpperCase(s.charAt(0)) + s.substring(1);
3The output will be: Hello
1public class Guru99 {
2 public static void main(String args[]) {
3 String S1 = new String("minúsculas convertidas en mayúsculas");
4
5 // Convertir a UpperCase
6 System.out.println(S1.toUpperCase());
7 }
8}
9
1public class StringToUppercaseDemo
2{
3 public static void main(String[] args)
4 {
5 String str = "flower brackets";
6 String strUpper = str.toUpperCase();
7 System.out.println(strUpper);
8 }
9}