Question Replace all pi

please check my mistakes
class Main{
public static String pi(String str,int i){
if(str.length()<=1)
return str;
if(i==str.length()-1)
return re;
String re;
if(str.charAt(i)==‘p’ && str.charAt(i+1)=‘i’)
{
re=str.substring(0,i)+“3.14”+str.substring(i+1);
return pi(str,i+2);
}
else
return pi(str,i+1);

}
public static void main(String args[]){
String d=pi(“apidpi”,0);
System.out.println(d);}}

@Sweta,
You are returning re but creating string re after that. Also you needn’t pass i in function pi.
I have corrected your code https://ide.codingblocks.com/s/165035

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.