A Simple Car Loan - Help

Hello, Can anyone tell me why I’m getting these error messages:
CarLoan.java:11: error: illegal start of type
if(loanLength <= 0 || interestRate <= 0){
^


public class CarLoan {
  public static void main(String[] args){
    
  }
  int carLoan = 10000;
  int loanLength = 3;
  int interestRate = 5;
  int downPayment = 2000;
  
  if(loanLength <= 0 || interestRate <= 0){
    System.out.println("Error! You must take out a valid car loan");
  } else if(downPayment >= 0){
    System.out.println("The car can be paid in full");
  } else {
    int remainingBalance = Carloan - downPayment;
    int months = loanLength * 12;
    int monthlyBalance = remainingBalance / 12;
    int interest = (monthlyBalance * interestRate) / 100;
    int monthlyPayment = monthlyBalance + interest;
    System.out.println(monthlyPayment);
  }

}

your main method is empty:

  public static void main(String[] args){
    
  }

why?

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.