Doubt in the output

please check my code .run time error is coming


you can see this.
if(s.length()==1){
ans=ans+s.charAt(0);
System.out.println(ans);
// missing return statement here
return ;
}