What does that version of code output to the console?
Why does the method have a print statement inside of it? What happens when you comment out the print statement that is inside of the method?...
Type: Posts; User: Norm
What does that version of code output to the console?
Why does the method have a print statement inside of it? What happens when you comment out the print statement that is inside of the method?...
Ok so the String returned by the toString method should have the elements of the array separated by a single space.
To do that write a loop that iterates though the array and concatenates each...
You need to decide what String the toString method will return and then work on the code to build that String.
I've asked for a sample String to show what you want the method to return.
Without...
Please post the exact String that the method should return for this array: int[] arr = { 3, 4, 5, 6, 7 };
For example: "34567"
Once we get that we can work on how to build that String.
What should the method return? Given this array: int[] arr = { 3, 4, 5, 6, 7 };
What should be in the String the method returns?
Post what the desired String would look like for that array.
...
What happens when the code is compiled? Any errors?
If no errors, what happens when the code is executed?
What is the toString method supposed to do? Given the array: int[] arr = { 3, 4, 5, 6,...
Sorry, I have no idea what you are asking.
Can you post the code and a description of what it is supposed to do?
The code is calling itself repeatedly until the callstack exceeds the available memory.
You should NOT give your class the same name (Arrays) as a java SE class: java.util.Arrays.
Change the name...
Please copy the full text of the error message and paste it here. It has important info about the error.
Those 3 lines of code in post#5 work for me.
To call a non-static method you need a reference to an instance of the class.
System.out.println(toString()); // calls default toString method
System.out.println(toString(Array)); // calls...
Please explain. If there are error messages, copy the full text and paste it here.
How are you calling the method? Where is the code that passes it an int array?