public String toString() // returns a String
The return type of this method is a String, but you don't have a return statement at all. You need to have a return statement, which returns a String from this method. There is no problem with using a System.out.printf.
public String toString()
{
System.out.println("Shown are the prices for " +
"each seat. A 0 indicates the seat is " +
"unavailable.");
for(int i = 0; i < 9; i++)
{
for(int j = 0; j < 10; j++)
{
System.out.printf("%8d", seatArray[i][j]);
}
}
return someString; // return statement is required as the method return type is String and not void
}
Note that, you can't change the return type to void, because when you use the toString() name for your method, it is overriding the toString() method of the Object class, whose return type is String. You can either rename the method and make it void, or if you wish to keep the same name(and override the Object.toString()), then you need to have a return statement for sure.
public void printArray() // Something like this
And yeah, whether the return type is void or String, you can always print your array in the fashion you've done. Just that if its a String return type, you'll have to return a String along with the printing you did in the method.