首页
String str = “i” 和String str = new String(“1”)一样吗?
不一样,因为内存的分配方式不一样。String str = "i"的方式JVM会将其分配到常量池中,而 String str = new String("i")JVM会将其分配到堆内存中。
八股文
相关
迟来的flag,至今已有672名学长靠这套Java八股文成功入职大厂
除了背八股文,Java面试更该这样准备
标签