Im running into a problem in my code and cant figure out how I can get it to restart or exit upon completion.

public static void main(String[] args) {

JOptionPane.showMessageDialog(null, "Welcome to Morgage Calculator", "McBride Financial INC", JOptionPane.PLAIN_MESSAGE);
    String princible;
        princible = JOptionPane.showInputDialog(null, "Step 1:   Enter Mortgage Amount" );
    String IR;
        IR = JOptionPane.showInputDialog(null, "Step 2:   Enter Interest Rate example 5.75 for 5.75%");
    String years;
        years = JOptionPane.showInputDialog(null, "Step 3:   Enter Term Limit in years");


JOptionPane.showConfirmDialog(null, "Would you like to enter new data?", "McBride Financial INC", JOptionPane.YES_NO_OPTION);

...After YES_NO_OPTION I cant get it back to enter new Mortgage info

Any insight would be great!

Are you getting the return value from the final dialog? Use that to control a loop.

boolean again = true;
while (again)
{
  all of that;
 
  if (dialog returns YES_OPTION) { do one thing} 
  else if (dialog returns NO_OPTION {do another thing}
  else { uh-oh, this shouldn't happen!)

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.