java - How to get data form an array in a method -
i'm creating project using java, have error. have created method generate results array, when use don't results i'm looking for. please me on this, here code.
public static string[] getyear(){ string[] w = new string[6]; int z = 0; for(int x = 7;x<7;x++) { w[z] = string.valueof(x); z = z++; } return w;
this how combobox
code looks:
com_year.additem(form_student.getyear());
when i'm using in combobox
result this:
[ljava.lang.string;@1073463
but need this:
1 2 3 4 5 6
can u please me on this.
you loop condition incorrect. this
for(int x = 7;x<7;x++)
starts @ 7 not less 7 loop never runs.
i think wanted
for (int x = 0; x < w.length; x++)
also, output default tostring()
object (array doesn't override it). can use arrays.tostring(arr)
instead.
Comments
Post a Comment