package practice_3;
import javax.swing.JOptionPane;
public class ArrayTest {
public static void main(String[]args) {
String output = "";
int n[] = new int[10];
output += "subscript | value\n";
for (int i = 0; i< n.length; i++) {
output +=+i+ " | " + n[i] + "\n";
}
JOptionPane.showMessageDialog(null, output);
System.exit(0);
}
Everything is fine in this code, output +=+i+" | " + n[i] + "\n";
I wonder why I should use output +=+i in this part.
Can't I just use output + i or output + = i?
java array string
Available.
output += i + " | " + n[i] + "\n";
output += + i + " | " + n[i] + "\n";
We've seen that both have the same output.
output += .... It's all
output = output + .... I don't know why I wrote "+" in the beginning.
© 2024 OneMinuteCode. All rights reserved.