я получаю сообщение об ошибкеSystem.out.println не выводя переменную
finalAmount cannot be resolved to a variable
И это код в вопросе
public class DepositCalculator {
public static final double annualInterestRate = 1.0;
public static final int numberOfYears = 5;
public static final int monthsPerYear = 12;
public static final int deposit = 1000;
public static final int depositAmountIncrement = 1000;
public static void main(String[] args) {
System.out.println(finalAmount);
}
public static double calculateAmountNoCompounding(double deposit, double annualInterestRate, int numberOfYears) {
double finalAmount = deposit*(1+annualInterestRate*numberOfYears);
return finalAmount;
}
}
Да, компилятор верен. –
Переменные имеют * scope *. Методы требуют, чтобы вы их вызывали *. Я очень хотел бы начать с книги новичка на Java или учебников от Oracle. –