When this code is run, it outputs to nulli
. Why is this doing?
public static zero main (string [] args) {string [] a = new string [1]; String m = null; String c = "hi"; For (int i = 0; i & lt; c.length (); i ++) {a [0] = a [0] + c. Art et al. (I); } System.out.print (a [0]);
Before the loop, type:
A [0] = "";
i.e.
public static zero main (string [] args) {string [] a = new string [1]; String m = null; String c = "hi"; A [0] = ""; For (int i = 0; i & lt; c.length (); i ++) {a [0] = a [0] + c. Art et al. (I); } System.out.print (a [0]); }
No comments:
Post a Comment