I am unsure what to do as I am quite new to Java. I want to repeat this program again but it keeps giving me the error of my string being out of range. How do I approach this?
import java.util.Scanner;
import java.io.*;
public class LoanReport {
    public static void main(String[] args) throws IOException {
        double loanBalance;
        double interestRate;
        int loanYears;
        String answer;
        char again;
        // boolean again;
        Scanner keyboard = new Scanner(System.in);
// while(again)
// do{
        System.out.print("Enter the " + "loan amount.");
        loanBalance = keyboard.nextDouble();
        System.out.print("Enter the " + "annual interest rate.");
        interestRate = keyboard.nextDouble();
        System.out.print("Enter the " + "years of the loan.");
        loanYears = keyboard.nextInt();
        Amortization am = new Amortization(loanBalance, interestRate, loanYears);
        am.saveReport("LoanAmortization.txt");
        System.out.println("Report saved to " + "the file LoanAmortization.txt.");
        System.out.print("Would you like " + "to run another report? Enter Y for " + "yes or N for no: ");
//answer = keyboard.next(); 
        // again = answer.charAt(0);
//} 
//while(answer == 'Y' || answer  == 'y');
        answer = keyboard.nextLine();
        again = answer.charAt(0);
        if (again == 'N' || again == 'n') {
            System.exit(0);
        }
    }
}
I tried doing a boolean method but I'm unsure if I did that correctly.
 
     
    