【发布时间】:2016-03-19 23:17:34
【问题描述】:
我正在编写一些代码,并尝试使用System.out.println() 来打印对象的名称。
例如,使用代码String foo = new String("Hi");,我想打印出“foo”。
我该怎么做?
【问题讨论】:
-
System.out.println("foo"); -
@ElliottFrisch 不错!
-
是的,但那是硬编码的,这不好
-
我认为你应该阅读这篇文章。 meta.stackexchange.com/questions/66377/what-is-the-xy-problem你想达到什么目的?
标签: java object identifier