博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
字符串的常量池
阅读量:2162 次
发布时间:2019-05-01

本文共 484 字,大约阅读时间需要 1 分钟。

package cn.learn.day08.demo01;/*字符串常量池:程序当中直接写上的双引号字符串,就在字符串常量池中。对于基本类型来说,==是进行数值的比较。对于引用类型来说,==是进行【地址值】的比较。 */public class Demo02StringPool {    public static void main(String[] args) {        String str1 = "abc";        String str2 = "abc";        char[] charArray = {'a', 'b', 'c'};        String str3 = new String(charArray);        System.out.println(str1 == str2); // true        System.out.println(str1 == str3); // false        System.out.println(str2 == str3); // false    }}

转载地址:http://xgzzb.baihongyu.com/

你可能感兴趣的文章
剑指offer 19.二叉树的镜像
查看>>
剑指offer 20.顺时针打印矩阵
查看>>
剑指offer 21.包含min函数的栈
查看>>
剑指offer 23.从上往下打印二叉树
查看>>
剑指offer 25.二叉树中和为某一值的路径
查看>>
剑指offer 60. 不用加减乘除做加法
查看>>
Leetcode C++《热题 Hot 100-14》283.移动零
查看>>
Leetcode C++《热题 Hot 100-15》437.路径总和III
查看>>
Leetcode C++《热题 Hot 100-17》461.汉明距离
查看>>
Leetcode C++《热题 Hot 100-18》538.把二叉搜索树转换为累加树
查看>>
Leetcode C++《热题 Hot 100-19》543.二叉树的直径
查看>>
Leetcode C++《热题 Hot 100-21》581.最短无序连续子数组
查看>>
Leetcode C++《热题 Hot 100-22》2.两数相加
查看>>
Leetcode C++《热题 Hot 100-23》3.无重复字符的最长子串
查看>>
Leetcode C++《热题 Hot 100-24》5.最长回文子串
查看>>
Leetcode C++《热题 Hot 100-26》15.三数之和
查看>>
Leetcode C++《热题 Hot 100-28》19.删除链表的倒数第N个节点
查看>>
Leetcode C++《热题 Hot 100-29》22.括号生成
查看>>
Leetcode C++《热题 Hot 100-44》102.二叉树的层次遍历
查看>>
Leetcode C++《热题 Hot 100-47》236.二叉树的最近公共祖先
查看>>