There is a great deal of information out there on printing arrays in toString() but most suggest using Arrays.toString(arr); This however prints the whole array even the nulls and is formatted a specific way. I'm looking for a way to print the values in an array that are not null and to be able format it the way I want.
Example output.
Backyard is populated by:
Doug
Steve
Dog
I understand that my Backyard is another class. I'm just unsure of how to get output like that. Because I only used three spaces of the array and that means there are 7 spaces that are null that I do not want it to print.
If you need me to clarify something let me know. This is kind of confusing.
Thanks.