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. Spark Standalone spark-env.sh

    export JAVA_HOME=/app/jdk export SPARK_MASTER_PORT=7077 export SPARK_MASTER_WEBUI_PORT=8080 export S ...

  2. “HtmlAgilityPack”已拥有为“System.Net.Http”定义的依赖项的解决方案

    #事故现场 在vs2013上用nuget安装 HtmlAgilityPack -Version 1.8.9时,报错如下: Install-Package : “HtmlAgilityPack”已拥有为 ...

  3. bash 特殊变量

    脚本参数 $* $@ $N shift 执行一个脚本时可以传递参数, 事实上每个参数都有对应的变量$0~$9 ./start.sh  a   b   c $0           $1 $2 $3 当 ...

  4. [再寄小读者之数学篇](2014-06-23 积分不等式 [中国科学技术大学2013年高等数学B 考研试题])

    设 $f(x)$ 在 $[a,b]$ 上一阶连续可导, $f(a)=0$. 证明: $$\bex \int_a^b f^2(x)\rd x\leq \cfrac{(b-a)^2}{2}\int_a^b ...

  5. [物理学与PDEs]第2章习题4 习题 3 的变分

    设 ${\bf u}$ 为满足第 3 题中条件的解. 证明 ${\bf u}$ 为如下变分问题 $$\bex \min_{{\bf w}\in A}\cfrac{1}{2}\int_\Omega |{ ...

  6. Nmpy函数总结

    函数和方法method总览 这是个Numpy函数和方法分类排列目录. 创建数组 arange, array, copy, empty, empty_like, eye, fromfile, fromf ...

  7. Mysql的跨服务器 关联查询--Federated引擎

    1.确认开启Federated引擎     查询FEDERATED功能是否开启: show ENGINES;       2.如果状态为NO则需修改my.ini文件,增加一行federated配置: ...

  8. SpringBatch框架简介

    概观 轻量级,全面的批处理框架,旨在开发对企业系统日常运营至关重要的强大批处理应用程序. Spring Batch提供了可重复使用的功能,这些功能对于处理大量记录至关重要,包括记录/跟踪,事务管理,作 ...

  9. python的request包

    1,request包基本用法 import requests a=requests.get("http://www.baidu.com")print a.text #以文本形式打印 ...

  10. LeetCode 第五题 最长的回文字符串 (JAVA)

    Longest Palindromic Substring 简介:字符串中最长的回文字符串 回文字符串:中心对称的字符串 ,如 mom,noon 问题详解: 给定一个字符串s,寻找字符串中最长的回文字 ...