JAVA Project, create a display table consisting of 4 rows 11 columns -


import javax.swing.joptionpane; public class lab {      public static void main(string[] args) { //don't comment out         // todo auto-generated method stub           string output = "";          (int x = 1; x <= 4; x++)         {             (int y = 0; y <= 9; y++)             {                 output = output + x*y + "  ";             }             output = output + "\n";         }          joptionpane.showmessagedialog(null,output);     } } 

//i need create program display table showing

1 0 1 2 3 4 5 6 7 8 9 2 0 2 4 6 8 10 12 14 16 18 3 0...................... 4 0.......................  

and far program starts 0. wondering how code start first column of 1,2,3,4 , second column of 0,0,0,0

try this:

public class test  {     public static void main(string args[]) {         string output = "";          (int x =1; x <= 4; x++) {             output += x + " ";             (int y = 0; y <= 9; y++) {                  output = output + x*y + "  ";              }             output = output + "\n";         }         joptionpane.showmessagedialog(null,output);     } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -