Why do I get this error?

I keep getting the following error:

Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Syntax error, insert “}” to complete ClassBody

    at Project2.main(Project2.java:17)

Except I have all the curly brackets and don’t seem to be missing one, so why do I keep getting this?
Here is my code:
import java.util.*;

public class Project2 {

public static void main(String[] args){

    //create scanner

    Scanner sc = new Scanner(System.in);

    //user input investment amount

    System.out.print("Enter the amount invested: ");

    double investmentAmount = sc.nextDouble();

    //user input interest rate

    System.out.print("Enter the annual interest rate: ");

    double monthlyInterestRate = sc.nextDouble();

    //# of years(30)

    int years = 30;

    //call method



public static double futureInvestmentValue(investmentAmount, monthlyInterestRate, years){

    //futureInvestmentValue = investmentAmount*(1 + monthlyInteresRate)^(numberOfYears*12)

    //can return a double value

    double pow = 30*12;

    double a = 1 + monthlyInterestRate;

    double b = pow;

    for(int i = 0; i < 30; i++){

        double[] numYears = new double[i];


    for(int j = 0; i < 30; j++){

        double [] fIV = new double[30];

        j = investmentAmount * Math.pow(a, b);


    return i;

    return j;



You call method futureInvestmentValue() without specifying parameters (though you declare the method to take parameters).

You also do not specify the types of each method parameter in the method declaration.

1 Like

I originally did have those in there, but took them out to see if it would fix the error. Forgot to put them back before posting this, sorry.

And you still have the same error? Once I resolved both of those issues, the program did not throw that error (though it did experience different ones later in the program).

1 Like

ooooo I got both of them in there now, sorry. Thank you. I’ll keep working on those other errors

1 Like