I'm having a problem with the toString method, or my code could be wrong. Heres an example:public class TestClass { private TestClass[] a; private int[] b; public TestClass(int...b) // Constructor { this.b { public TestClass[] concat(TestClass...b1) { TestClass[] temp = new TestClass[b1.length+b.length] for(int i = 0;i<=temp.length;i++) return TestClass(temp[i]); //Trying to return the elements of two arrays put together, I think this could be wrong }
How would I do my toString?
I want to be able to do something like this :
(main)
TestClass a1 = new TestClass[1,2,3,4]; TestClass a2 = new TestClass[5,6,7,8,9]; TestClass a3; // Need help on this also, how do I overload my constructor to get an empty set of array? a3 = a1.concat(a2); System.out.print(a3); //Want the results " 1,2,3,4,5,6,7,8,9,10 "