public static void main(String[] args)
{
//Enter savings amount
String savingsAmountString = JOptionPane.showInputDialog(
" Enter savings amount");
//Convert string to double
double savingsAmount = Double.parseDouble(savingsAmountString);

//enter interest
String interestRateString = JOptionPane.showInputDialog(
"Enter annual interest rate ");
//Convert String to double
double annualInterestRate = Double.parseDouble(interestRateString);


//Enter number of months
String numberOfMonthsString = JOptionPane.showInputDialog(
"Enter number of months");
//Convert string to double
double numberofMonths = Double.parseDouble(numberOfMonthsString);


//obtain monthly interest rate

double newBalance = savingsAmount * Math.pow((1+annualInterestRate/12),(numberofMonths*12)-1)/annualInterestRate);


String output = "after monts the result is" + newBalance;

JOptionPane.showConfirmDialog(null, output); 

Ok. And just what is your problem? You want us to analyze your code making untenable assumptions? Please get real...

that isn't even the entire main method.
it's impossible for us to make anything out of this, let alone know what you are looking for.
but, anyway, you have a ')' too much in your

double newBalance = savingsAmount * Math.pow((1+annualInterestRate/12),(numberofMonths*12)-1)/annualInterestRate);

no doubt your compiler already told you this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.