Boolean类里的getBoolean()方法问题。

high_land 2005-12-20 05:28:46
在Boolean类里的getBoolean(String name)方法。我输入了“TEMP”和“classpath”等一些系统环境变量,但是放回值不是true.而是false. 输入什么,放回值可以使true.
...全文
516 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
thomas_20 2006-01-25
  • 打赏
  • 举报
回复
Properties p = System.getProperties();
p.setProperty("test", "true");
System.out.println("Boolean.getBoolean():" + Boolean.getBoolean(p.getProperty("test").tostring));
denny009 2006-01-24
  • 打赏
  • 举报
回复
ding
high_land 2006-01-24
  • 打赏
  • 举报
回复
设置指定key指示的系统属性,有什么用?
high_land 2006-01-23
  • 打赏
  • 举报
回复
设置指定key指示的系统属性,有什么用?
high_land 2005-12-31
  • 打赏
  • 举报
回复
设置指定key指示的系统属性,有什么用?
high_land 2005-12-29
  • 打赏
  • 举报
回复
设置指定key指示的系统属性,有什么用?
iwlk 2005-12-25
  • 打赏
  • 举报
回复
关注
PhoticX 2005-12-24
  • 打赏
  • 举报
回复
设置指定key指示的系统属性。
首先,如果有一安全管理器,调用验证方法SecurityManager.checkPermission(key, "write"),可能会可出一个安全异常。
如果没有抛出异常,用value设置指定的系统属性值。
返回以前的值或null。

PhoticX 2005-12-24
  • 打赏
  • 举报
回复
public static String setProperty(String key,
String value)
Sets the system property indicated by the specified key.
First, if a security manager exists, its SecurityManager.checkPermission method is called with a PropertyPermission(key, "write") permission. This may result in a SecurityException being thrown. If no exception is thrown, the specified property is set to the given value.
Parameters:
key - the name of the system property.
value - the value of the system property.
Returns:
the previous value of the system property, or null if it did not have one.


yuzl32 2005-12-23
  • 打赏
  • 举报
回复
提问:
setProperty()中设置的"test"和"true",都是什么意思?

-----------------
设置 [名 - 值] 的对应关系,像Hashtable中的put(Object key, Object value)
high_land 2005-12-23
  • 打赏
  • 举报
回复
Properties p = System.getProperties();
p.setProperty("test", "true");
System.out.println("Boolean.getBoolean():" + Boolean.getBoolean("test"));

提问:
setProperty()中设置的"test"和"true",都是什么意思?
nego_orange 2005-12-22
  • 打赏
  • 举报
回复
那个string如果是true返回的就是true,否则无论你输入什么都是false
beihehuaiyu 2005-12-20
  • 打赏
  • 举报
回复
If there is no property with the specified name, or if the specified name is empty or null, then false is returned.
beihehuaiyu 2005-12-20
  • 打赏
  • 举报
回复

static boolean getBoolean(String name)
Returns true if and only if the system property named by the argument exists and is equal to the string "true".
beihehuaiyu 2005-12-20
  • 打赏
  • 举报
回复
Properties p = System.getProperties();
p.setProperty("test", "true");
System.out.println("Boolean.getBoolean():" + Boolean.getBoolean("test"));

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧