How can I print system.out.print message into a JOptionPane.ShowMessageDialog I need it to run through the for loop and then outside the for loop I need it to display inside of
Try to write output to StringBuilder
StringBuilder sb = new StringBuilder() for (int i = 0; i < numberOfLoans; i++) {
sb.append(String.format("%d\t%s\t%d %.2f %.2f\n", sellingPrice, downPayment, loanAmount, annualInterestRatesArray[i], numberOfYearsArray[i], monthlyPaymentArray[i]));
}
String toDisplay=sb.toString();