Listing 7. Example formattable usage.
清单7. formattable使用示例。
Listing 9. Example formattable output.
清单9. formattable输出示例。
Listing 7 demonstrates the use of the Formattable interface by providing a simple class with a name property.
清单7演示了通过提供一个具有name属性的简单类来使用Formattable接口。
If you want to provide support for using your own objects with Formatter, that's where the Formattable interface comes into play.
如果希望用Formatter提供对自己的对象的支持,那么就要用到Formattable接口。
When creating your own custom classes, not only should you provide a toString implementation, but implementing the Formattable interface will typically be beneficial.
在创建自己的自定义类时,不仅提供一个toString实现,而且实现Formattable接口通常会有帮助。
When creating your own custom classes, not only should you provide a toString implementation, but implementing the Formattable interface will typically be beneficial.
在创建自己的自定义类时,不仅提供一个toString实现,而且实现Formattable接口通常会有帮助。
应用推荐