0
Is capitalize is not exist in java Showing error ?
public static void main(String[] args) { String str="sachin"; System.out.print(str.capitalize()); }
4 ответов
+ 2
String class dose not has capitalize() method in Java like in Python. You can use: str.substring(0,1).toUpperCase()+str.substring(1)
+ 4
You mean toUpperCase() ?
str.toUpperCase() returns "SACHIN".
+ 2
I searched using google on "how to capitalize a word in java" But i see no method such as "capitalize", the only one i see is "toUpperCase"
0
In JavaScript, we have a method called toUpperCase(), which we can call on strings, or words. As we can imply from the name, you call it on a string/word, and it is going to return the same thing but as an uppercase.