I am creating a String array and using System.out.println to print the values in the array. All good and works as expected, returning [South Africa, England] but the code won't compile unless I include a return statement, but the return statement just dumps out a load of garbage "[Ljava.lang.String;@85bdf6". Is there any way I can either combine the System.out.println and return statements so they do the same thing, and I just have [South Africa, England] appearing?
public String[] teamsToProgress()
{
Arrays.sort(teams);
String[] teamsToProgress;
teamsToProgress = new String[2];
String team1 = teams[0].getName();
String team2 = teams[1].getName();
teamsToProgress[0] = team1;
teamsToProgress[1] = team2;
System.out.println(Arrays.toString(teamsToProgress));
return teamsToProgress;
}