java.lang.Boolean.valueOf(String s)
2024-08-30 05:05:08
简单说,就是s为true(这四个字母大小写任意)时,返回值为true,否则为false
public class one { public static void main(String[] args) {
Boolean b1, b2; // create 2 String's and assign values
String s1 = null;
String s2 = "truE"; /**
* static method is called using class name
* assign result of valueOf method on s1, s2 to b1, b2
*/
b1 = Boolean.valueOf(s1);
b2 = Boolean.valueOf(s2); System.out.println(b1);
System.out.println(b2);
String str1 = "Boolean instance of string " + s1 + " is " + b1;
String str2 = "Boolean instance of string " + s2 + " is " + b2; // print b1, b2 values
System.out.println( str1 );
System.out.println( str2 );
}
}
执行结果为:
最新文章
- CSS常见居中讨论
- hdfs shell 命令以及原理
- 【SharePoint学习笔记】第3章 SharePoint列表新特性以及数据访问
- Python 之 【re模块的正则表达式学习】
- 安装SQL Server 2005
- Linux系统中为php添加pcntl扩展的方法
- css3实现一个div设置多张背景图片及background-image属性
- C语言函数qsort的使用方法
- go结构体方法
- EL表达式与标签库
- (15)Python时间
- centos 安装 FLEXPART
- js保存,获取,删除cookie的操作
- C++动态(显式)调用 C++ dll
- pandas read_csv 读取中文列标题文件报错
- Springboot_StringRedisTemplate配置
- JavaScrip总体
- 微信小程序绑定数据(微信小程序交流群:604788754)
- 微信小程序 功能函数 获取验证码*
- Postgresql HStore 插件试用小结