Yes, you can treat values returned from a method call as variables, the problem is that doBubbleSort returns void, i.e it doesn't return anything.
Try to review your code and return the sorted list instead.
Claude Moore wrote:return the sorted list instead.
No. If someone asks you "How do I kick myself in the head?" you don't tell them to stretch and try really hard.
@OP: Don't mix concerns. That is, if you're trying to do some kind of calculation, write a method that does just the calculation. If you're trying to display something, the code that does that should be isolated from any other concern. Avoid mixing display concerns with other kinds of concerns, otherwise, your design will be too tightly coupled.
Your doBubbleSort method appears to sort its argument in place. That is, the unsorted array that you pass in to the method will be the sorted array when the method completes its work successfully. Therefore, after calling doBubbleSort, whatever is in array is going to be sorted (assuming your doBubbleSort is correct, which I have not verified).
This means you don't have to do what you're trying to do on line 6 at all.