java - Why doesnt my program print the data it receives instead of the address? -


i have created java program 2 classes. 1 class(main) contains array of data passed second class(planning). second class(planning) uses array assign values variables 'input , output'. code looks this:

////main.java/// import java.util.arraylist public class main{ public enum state{a, d, h};  planning plan = new planning[]{       new plan(new state[]{state.a,state.a,state.a,state.a}, new state[]{state.d,state.a,state.a,state.d,state.a,state.a})} 

the other class planning.java looks this:

public class planning {       main.state[] input;     main.state[] output;     planning(main.state[] input,main.state[] output){     this.input = input;     this.output = output;      system.out.println("the state " + input); } 

however when printout 'input @ end' displays

[lmain$state;@4e98f805

i want display array passed main function. kindly tell me how can achieve this?

maybe try use system.out.println("the state " + arrays.tostring(input));

because printing input equivalent printing input.tostring(); , print memory address of array.

see http://docs.oracle.com/javase/7/docs/api/java/util/arrays.html


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -