Wednesday, 15 April 2015

java - How to print an array -



java - How to print an array -

i'm novice in java programming. couldn't grab in next case why can't print array line:

system.out.print(arr());

instead of of results got this: '[d@60e1e567'

what did wrong?

public class test { public static void main(string[] args) { system.out.print(arr()); } public static double[] arr() { double res; int count=0; double[] anarray = new double[100000000]; int k=0; (int j=2;j<101;j++){ for(int i=2; i<101;i++) { res=math.pow(j,i); anarray[k]=res; k++; } } homecoming anarray; } }

system.out.println(arrays.tostring(arr()));

returns string representation of contents of specified array. string representation consists of list of array's elements, enclosed in square brackets ("[]"). adjacent elements separated characters ", " (a comma followed space). elements converted strings string.valueof(double). returns "null" if array null.

java arrays

No comments:

Post a Comment