Although it need not be, the expression is usually an identifier. Whether it is an identifier
or an expression, the value of the identifier or the expression can only be of type int, byte, short,
or char.

public class StringComapre {

    public static void main(String[] args) {    

    String    str1 = new String("Hello");
String str2 = "Hello"; if (str1 == str2)
System.out.println("str1 equal str2");
else
System.out.println("str1 != str2"); //////////////////////////////////////////////////////// String str3 = "Hello";
String str4 = new String("Hello"); if (str3 == str4)
System.out.println("str3 equal str4");
else
System.out.println("str3 != str4"); /////////////////////////////////////////////////////// String str5 = new String("Hello");
String str6 = new String("Hello"); if (str5 == str6)
System.out.println("str5 equal str6");
else
System.out.println("str5 != str6"); }
}

这段代码有疑问,为什么str1 和 str2不相等?

Chapter 4 : Control Structures 1 : Selection的更多相关文章

  1. Chapter 5 : Control Structures 2 : Repetition

    import java.util.*; import java.io.*; public class Loop { static Scanner console = new Scanner(Syste ...

  2. Python - 4. Control Structures

    From:http://interactivepython.org/courselib/static/pythonds/Introduction/ControlStructures.html Cont ...

  3. 【Scala】Scala之Control Structures

    一.前言 前面学习了Scala的Numbers,接着学习Scala的Control Structures(控制结构). 二.Control Structures Scala中的控制结构与Java中的颇 ...

  4. R Programming week2 Control Structures

    Control Structures Control structures in R allow you to control the flow of execution of the program ...

  5. Scala Control Structures

    Scala之Control Structures 一.前言 前面学习了Scala的Numbers,接着学习Scala的Control Structures(控制结构). 二.Control Struc ...

  6. AOAPC I: Beginning Algorithm Contests -- Training Guide (Rujia Liu) Chapter 3. Data Structures Fundamental Data Structures

    10410 这题说的是给了一棵多叉树的 bfs遍历轨迹 和dfs 遍历 轨迹 在父节点向叶子节点扩展的时候优先遍历编号较小的节点.我还原出这课树特殊判定 根据bfs的顺序来建立这课树,用一个队列安排要 ...

  7. Scala入门指南与建议

    最近在学习使用Scala语言做项目,感觉这门语言实在是太优美了!作为一个本科数学.研究生机器学习专业的混合人才(哈哈),这门语言真的是满足了普通计算机编程(告诉计算机怎么做)和函数式编程(告诉计算机做 ...

  8. Core Java Volume I — 3.8. Control Flow

    3.8. Control FlowJava, like any programming language, supports both conditional statements and loops ...

  9. Tutorial: WPF User Control for AX2012

    原作者: https://community.dynamics.com/ax/b/goshoom/archive/2011/10/06/tutorial-wpf-user-control-for-ax ...

随机推荐

  1. pta寒假作业3

    题目三:捉老鼠啊,亏了还是赚了 实验代码 #include <stdio.h>     #include <stdlib.h> int main(void)    {      ...

  2. codeforces-1140 (div2)

    A.维护一个前缀最大值,不断跳即可 #include <map> #include <set> #include <ctime> #include <cmat ...

  3. usb描述符简述(二)

    title: usb描述符简述 tags: linux date: 2018/12/18/ 18:25:23 toc: true --- usb描述符简述 转载自cnblog 具体描述符 https: ...

  4. Pandas系列(十二)-可视化详解

    目录 1. 折线图 2. 柱状图 3. 直方图 4. 箱线图 5. 区域图 6. 散点图 7. 饼图六边形容器图 数据分析的结果不仅仅只是你来看的,更多的时候是给需求方或者老板来看的,为了更直观地看出 ...

  5. 【SQL】INSERT INTO SELECT语句与SELECT INTO FROM语句

    INSERT INTO SELECT语句与SELECT INTO FROM语句,都是将一个结果集插入到一个表中: #INSERT INTO SELECT语句 1.语法形式: Insert into T ...

  6. VUE-开发工具VSCode

    VUE-开发工具之VSCode VSCode是微软出的一款轻量级代码编辑器,免费而且功能强大,对JavaScript和NodeJS的支持非常好,自带很多功能,例如代码格式化,代码智能提示补全.Emme ...

  7. 第二节: 比较EF的Lambda查询和Linq查询写法的区别

    简介 在前面EF的介绍中,曾多次提到过EF可以使用Lambda和Linq来完成对数据库的访问,这两种的语法的具体使用和注意事项在前面的DotNet进阶的系列章节中已经详细介绍过了,本次借着EF章节,重 ...

  8. Vue-cli 模拟数据库

    vue-cli2.x 版本开发: 新版在build目录下的webpack.dev.conf.js配置本地数据访问: 1,在const portfinder = require(‘portfinder’ ...

  9. MySQL学习1 - 基本mysql语句

    一 操作文件夹(数据库) 增 查 改 删 二 操作文件(数据表) 增 查 改 删 三 操作文件内容(数据记录) 增 查 改 删 一 操作文件夹(数据库) 增 create database db1 c ...

  10. 常见的cmake工程做法

    第一步,创建一个build目录存放cmake生成的中间文件: mkdir build 第二步,进入到build文件目录: cd build 第三步,cmake把代码文件生成一个makefile文件: ...