public String toString() { // this is in anther class
String Cubes = "+";
for(int i = 0; i < CubesStack.length;) {
Cubes = Cubes + CubesStack[i].toString();
}
return "maxCubes = " + this.maxCubes + "\n" +
"currentCubes = " + this.currentCubes + "\n" +
"CubesStack = " + Cubes;
}
public class MainMain { // this is main
public static void main(String[] args) {
// TODO Auto-generated method stub
cubesTower tower1 = new cubesTower(20);
System.out.println(tower1.toString());
}
}
why i cant print using 'tostring' ? how can i print arry that includes classes in it ? thank you very much .