解决方案 »
- 一个public class类几行代码比较合适,也比较易懂。??
- 在sql 中碰到的问题
- 插入了数据,却看不见!
- 代码中的TODO Auto-generated catch block代码
- 请问如何比较这两个变量?
- 请教一下java中怎么分隔字段,怎样实现顺序读取啊?
- 怎样给选中的节点添加子节点?
- 怎么把StringBuilder根据里面的某个特定字符转化成String数组
- String str = "1,1;2,3;3,5;4,8;5,11;6,15;";如何变为
- 请教一个问题:JAVA怎么判断局域网内其他机器是否在线(开机)?
- 一个简单问题:如何删除英文单词中多余的空格,即:单词间只允许一个空格?
- Thread中的start()方法实现
public class ex2 {
double f;
String s; public void print(double x) {
ex2 exs = new ex2();
exs.s = exs.getClass().getSimpleName();//就是这的问题
System.out.println("The value of " + exs.s + " is:" + x);
}
}
谢谢LS的,但是这样只能得到实例所引用的类名,得不到当前的实例名,看了一个别的论坛的帖子,有人问到类似的问题,貌似也没有解决方法,因为每次编译后得到的名字只是地址,名字不专门做存储.不知对否...
"I'm afraid, that there is no way to do this. The name "xxx" is no name at
all. It is just an identifier you named for the compiler. When it get's
compiled every access to xxx is substituted with the objects memory
address."
谢谢各位!