title: Outputting multiple messages in the same message box?
body: <p>This code technically works but now I need to output it in a message box. I tried putting a message box in front of each thing it has to display but that outputs it on multiple different message boxes. How can I make it so the program outputs it into one message box? Here is my code </p>
  
  <pre><code>import javax.swing.JOptionPane;
  public class CozaLozatest
  {
    public static void main(String[] args)
   {
   int result2=0;
  String n = JOptionPane.showInputDialog("Please input an interger");
   int result = Integer.parseInt(n);
  
  for (int i=0; i&lt;result; i++){
  
  JOptionPane.showMessageDialog(null," ");
          ++result2;
      if (result2 % 11 == 0)
         JOptionPane.showMessageDialog(null," ");
  
       if (i % 3 == 0 &amp;&amp; i % 5 == 0 &amp;&amp; i % 7 == 0) {    
         JOptionPane.showMessageDialog(null,"CozaLozaWoza");} 
  
   else if (i % 3 == 0 &amp;&amp; i % 5 == 0) {
      JOptionPane.showMessageDialog(null,"CozaLoza");
  
    } else if (i % 5 == 0 &amp;&amp; i % 7 == 0) {
         JOptionPane.showMessageDialog(null,"LozaWoza");
  
    } else if (i % 5 == 0) {
         JOptionPane.showMessageDialog(null,"Loza");
  
    } else if (i % 3 == 0) {
       JOptionPane.showMessageDialog(null,"Coza");
  
      } else if (i % 7 == 0) {
       JOptionPane.showMessageDialog(null,"Woza");
  
  
  
  
    } else {
       JOptionPane.showMessageDialog(null," "+i);
  
   }
  }
  
      }
  }
  </code></pre>
  
  <p>Also here is my code that works without the output boxes</p>
  
  <pre><code>import javax.swing.JOptionPane;
  public class CozaLozaFinished
  {
    public static void main(String[] args)
    {
     int result2=0;
      String n = JOptionPane.showInputDialog("Please input an interger");
       int result = Integer.parseInt(n);
  
  for (int i=0; i&lt;result; i++){
  
   System.out.print(" ");
          ++result2;
      if (result2 % 11 == 0)
        System.out.println();
  
       if (i % 3 == 0 &amp;&amp; i % 5 == 0 &amp;&amp; i % 7 == 0) {    
         System.out.print("CozaLozaWoza");} 
  
   else if (i % 3 == 0 &amp;&amp; i % 5 == 0) {
      System.out.print("CozaLoza");
  
    } else if (i % 5 == 0 &amp;&amp; i % 7 == 0) {
        System.out.print("LozaWoza");
  
    } else if (i % 5 == 0) {
        System.out.print("Loza");
  
    } else if (i % 3 == 0) {
      System.out.print("Coza");
  
      } else if (i % 7 == 0) {
      System.out.print("Woza");
  
  
  
  
    } else {
      System.out.print(" "+i);
  
    }
  }
  
      }
  }
  </code></pre>