How would you display each element of an array that is returned from another method in Java? -
for example, have main method method returnodds(original), returns integer array "odd"
how print elements of array in main method? loop?
a for
loop work. if don't care format, though, simpler solution might use arrays.tostring
, convert in form "[elem1, elem2, ..., elemn]"
.
Comments
Post a Comment