1、添加pom文件
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
2、src代码:
public static void main(String[] args) {
System.out.println(StringUtils.isEmpty(null));
System.out.println(StringUtils.isEmpty(""));
System.out.println(ObjectUtils.anyNotNull(null, null));
System.out.println(ObjectUtils.anyNotNull(11, null));
System.out.println(RandomUtils.nextBoolean());
System.out.println(RandomUtils.nextBoolean());
System.out.println(SystemUtils.JAVA_HOME);
}
3、总结:
官网说commons-lang3主要目的是提供更多的工具类,其实也就是方便我们的开发,具体API需要自己研究。