Answers for "lower to upper case but only first character in string java"

3

how to uppercase the first letter of a string in java

String str = "java";
String cap = str.substring(0, 1).toUpperCase() + str.substring(1);
// cap = "Java"
Posted by: Guest on November-24-2020
4

java method to capitalize first letter

String str = "java";
String cap = str.substring(0, 1).toUpperCase() + str.substring(1);
// cap = "Java"
Posted by: Guest on May-04-2020
2

capitalize string java

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!
Posted by: Guest on June-02-2020

Code answers related to "lower to upper case but only first character in string java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language