import javax.swing.JOptionPane; public class RecursiveTest{ public static void main (String args[]){ int result, b, e; b = Integer.parseInt(JOptionPane.showInputDialog("Enter the base value :")); e = Integer.parseInt(JOptionPane.showInputDialog("Enter the exponent value :")); result = startAddition(b, e); JOptionPane.showMessageDialog(null, "Power of " + b + ", " + e + " = " + result); } public static int startAddition(int value, int loop){ if(loop == 1){ return value; }else{ return value + startAddition(value, loop-1); } } }