Is it possible in Java to override a toString for an Objects array?
For example, let's say I created a simple class, User
(it doesn't really matter which class is it since this is a general question). Is it possible that, once the client creates a User[]
array and the client uses System.out.print(array)
, it won't print the array's address but instead a customized toString()
?
PS: of course I can't just override toString()
in my class since it's related to single instances.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…