Sum of integers in the given number using recursive method in Java

class Sum
int sum =0;
int addDigit(int num)
if( num == 0)
return 0;
sum = num%10 + addDigit(num/10);
return sum;
class SumRecursive
public static void main(String []a)
Sum s = new Sum();
int num;
System.out.println("Enter the number:");
num = Integer.parseInt(System.console().readLine());
int output= s.addDigit(num);
System.out.println("Sum of digits in the given number is:"+ output);

Enter the number:
Sum of digits in the given number is:14