public class Main {
public static void main(String[] args) {
//write java program to convert the first character in a string to uppercase
String s="nerdutella.com";
String firstChar=Character.toString(s.charAt(0));
firstChar=firstChar.toUpperCase();
String newS=firstChar;
for(int i=1;i<s.length();i++)
newS=newS+Character.toString(s.charAt(i));
System.out.println("the string after converting first character to uppercase: "+newS);
}
}
output:
the string after converting first character to uppercase: Nerdutella.com
output:
the string after converting first character to uppercase: Nerdutella.com
need an explanation for this answer? contact us directly to get an explanation for this answer