Java
Programming and Technical
Programming
Program
write a java programof string ; first letter should be upper case and rest in lowecase
Read Solution (Total 3)
-
- Divide and concur
Divide string with '0' th index and remaining
Convert the content at 0th index to capital letter
then concate the string - 7 years agoHelpfull: Yes(1) No(0)
- Psvm(string[] args) string st="Placement"; char ch[]=st.tocharArray(); for(int i=0;ch[i-1]==' '){if(ch[i]>=97&&ch[i]=65&&ch[i]
- 7 years agoHelpfull: Yes(0) No(1)
- package com.java.String_Class;
public class FirsttoCap {
public static void main(String[] args) {
String s="This is rupesh reddy";
String s3="";
for (int i = 0; i < s.length(); i++) {
String s2=""+s.charAt(i);
if(i==0){
s3+=s2.toUpperCase();
System.out.println("@i==0 "+s3);
}
else if (s.charAt(i)==' ') {
i++;
s2+=s.charAt(i);
s3+=s2.toUpperCase();
System.out.println("@i==space "+s3);
}
else{
s3+=s2;
System.out.println("@i==other "+s3);
}
}
System.out.println(s3);
System.out.println(s);
}
} - 7 years agoHelpfull: Yes(0) No(0)
Java Other Question