String to integer

how can i do it with recursion?is there any keyword?

no you dont need any keyword
see this :

   int convert(string c, int n){    
        if(n== 0){
            return 0;
        }
        int digit = c[n-1] - '0';
        int x = convert(c,n-1);
        return x*10 + digit;
    }

package recursionprobl;

import java.util.Scanner;

public class strtoint {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int li=convert(str,0);
System.out.println(li);
}
public static int convert(String str, int n) {
if(n==0) {
return 0;
}
int digit = str[n-1]-β€˜0’;
int x = convert(str,n-1);
return x*10 + digit;

 }

}

how to resolve it…??

yeah ,We traverse the string from left to right , extract the character but subtracting the ASCII value of β€˜0’ from it. Note that we have to raise this extracted digit to the power n , where n is the length of remaining string before adding it to the final number. We recursively traverse the string and update the value of number. In the base case , we return this value
this will be the correct code: