Boolean.parseBoolean("true") 和 Boolean.getBoolean("true");的区别及用法
正确用法:boolean repeatIndicator = Boolean.valueOf("true").booleanValue();
或者也可以使用Boolean.parseBoolean()方法,但此方法是jdk1.5以后推出的。
以下是Boolean.getBoolean的正确用法:
public class TestGetBoolean
{
public static void main(String[] args){
//大写的true返回为false,必须是小写的true
String s1 = "true";
String s2 = new String("true");
//这里将s1存放到Java系统属性中了.
System.setProperty(s1,"true");
System.setProperty(s2,"true");
//这里从系统属性中获取s1,所以获取到了。
System.out.println(Boolean.getBoolean(s1));//true
System.out.println(Boolean.getBoolean(s2));//true
String s3 = "true";
//很明显s3并没有存放到系统属性中所以返回false。
System.out.println(Boolean.getBoolean(s3));//false
//这个更是错的了,呵呵。
System.out.println(Boolean.getBoolean("true"));//false
}
}
Boolean.parseBoolean("true") 和 Boolean.getBoolean("true");的区别及用法的更多相关文章
- true && number !== boolean
true && number !== boolean bug let result = ``; // section, name ? create text, compute cent ...
- freemark标签从后台接过来数据Boolean在前台还是Boolean输出(四)
FREEMARK标签中输出BOOLEAN值 private boolean showHeader=true; public boolean getShowHeader(){ return this.s ...
- request.getSession(true)和request.getSession(false)的区别
request.getSession(true)和request.getSession(false)的区别 request.getSession(true):若存在会话则返回该会话,否则新建一个会 ...
- ReLU(inplace=True),这里的inplace=true的意思
ReLU(inplace=True),这里的inplace=true的意思 待办 inplace=True means that it will modify the input directly, ...
- 转:request.getSession(true)和request.getSession(false)的区别
1.转自:http://wenda.so.com/q/1366414933061950?src=150 概括: request.getSession(true):若存在会话则返回该会话,否则新建一个会 ...
- javascript中的return、return true、return false、continue区别
1.语法为:return 表达式; 2.w3c中的解释: 语句结束函数执行,返回调用函数,而且把表达式的值作为函数的结果 也就是:当代码执行到return语句时,函数返回一个结果就结束运行了,ret ...
- jquery prop('checked', true)解决attr('checked', true)不能选中radio问题
正如标题所言,使用:prop('checked', true)就可以了
- @RequestParam(required = true),@RequestParam(required = true)
今天在页面请求后台的时候遇到了一个问题,请求不到后台 页面代码 <li> <a href="javascript:void(0 ...
- Spark2.1.0——内置RPC框架详解
Spark2.1.0——内置RPC框架详解 在Spark中很多地方都涉及网络通信,比如Spark各个组件间的消息互通.用户文件与Jar包的上传.节点间的Shuffle过程.Block数据的复制与备份等 ...
随机推荐
- EXTJS 密码确认与验证
extjs 框架是一个非常优秀的前端框架,提供了丰富的功能与炫丽的界面展示,在用 extjs 创建表单时,特别是在注册或修改密码的时候,要对密码进行确认,这里就密码确认一致性验证和大家分享自己的心得与 ...
- Git 使用及原理 总结
1. $git diff origin/master master (show me the changes between the remote master branch and my mast ...
- Discussing the scenery in the program of 863 with Doctor Zhang!
今天,下午去了NEC找章丰博士师兄交流了一下863项目关于SDN场景的设置问题,通过交流感觉师兄的水平和层次完全在另一个层次,以及人家的谈吐. 主要的结论有以下几个:(1)移动性管理场景 (2)特殊 ...
- tech
流式计算框架storm.spark.genfire.esper(CEP)
- 用于MySql的SqlHelper
用于MySql的SqlHelper /// <summary> /// Title :MySqlHelper /// Author :WinterT /// Date :2015-1-8 ...
- div模拟下拉框
1.模拟下拉框.点击文本框在文本框下面显示一个层divList,点击divList以外的任何地方,关闭divList层 document.body.onclick = function (e) { e ...
- 利用Jquery处理跨域请求
在项目制作过程中,可能会用到ajax来提高用户体验,这里终于研究出来,利用jquery来进行跨域请求,在用$.getJSON这个方法时,前台页面中需这样写 $.getJSON(“需要提交处理的url? ...
- Dev的DocumentManager 相关问题
1.改变DocumentManager包含的窗体的排列方式 if (this.documentManager1.View.Type != ViewType.NativeMdi) { this.docu ...
- Linux redis 配置文件
# Redis configuration file example # Note on units: when memory size is needed, it is possible to sp ...
- 关于js一般对象与标配对象
当一个js函数对象被创建时,Function 构造器产生的函数对象会运行类似这样的一些代码 this.prototype={constructor:this} 新函数被赋予了一个prototype属性 ...