java - How do I nest a for loop to print a multidimensional Array? -
within program, have created array has been converted int multidimensional array of strings employeenamesa[2][i]
want use string builder can print in 1 joptionpane.showmessagedialog. having issues trying nested loop work.
stringbuilder builder = new stringbuilder (employeenamesa.length); (int i=0; i<employeenamesa.length; builder.append(employeenamesa[][i++])) { for(int j=0; j<2; builder.append(employeenamesa[j++][])) builder.append("\n"); } joptionpane.showmessagedialog(null, "employees new salary: " + builder.tostring() + "pbi paying more in total salary: $" + (totalsalary - totalnewsalary));
are looking this?
stringbuilder builder = new stringbuilder (employeenamesa.length); (int i=0; i<employeenamesa.length; i++)) { for(int j=0; j<2; j++) builder.append(employeenamesa[i][j]+"\n"); } joptionpane.showmessagedialog(null, "employees new salary: " + builder.tostring() + "pbi paying more in total salary: $" + (totalsalary - totalnewsalary));
Comments
Post a Comment