i cannot find out the error in output
Input : arunjib
required output : ArunjiB
output getting : ABarunjib
please help me
public class caps { public static void func(String x) { int i, len; char y; String z, x1; z=" "; x1=" "; len=x.length(); for(i=0;i<len;i++) { y=x.charAt(i); if(i==0 || i==len-1) { z=Character.toString(y); // converting character to string x1=z.toUpperCase(); // converting string to upper case x=x1+x; } } System.out.println(x); } }