在pom.xml中添加插件<plugin><artifactId>maven-assembly-plugin</artifactId><configuration><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></des
本文是对于Java字符串相关知识的一个补充,主要介绍字符串拼接相关的知识。基于JDK1.8_201。字符串拼接字符串拼接是在Java代码中经常要做的事情,我们都知道String是Java中一个不可变的类,一旦被实例化就无法被修改。但是既然字符串是不可变的,那么是如何进行字符串拼接呢?字符串不变性与字符串拼接其实所有的所谓字符串拼接,都是重新生成了一个新的字符串。比如以下代码:String str
观察一下代码,说出执行结果(JVM类加载)class A{static {System.out.print("1");}public A(){System.out.print("2");}}class B extends A{static {System.out.print("a");}public B(){System.out.prin