Chapter 4 : Control Structures 1 : Selection
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的更多相关文章
- Chapter 5 : Control Structures 2 : Repetition
import java.util.*; import java.io.*; public class Loop { static Scanner console = new Scanner(Syste ...
- Python - 4. Control Structures
From:http://interactivepython.org/courselib/static/pythonds/Introduction/ControlStructures.html Cont ...
- 【Scala】Scala之Control Structures
一.前言 前面学习了Scala的Numbers,接着学习Scala的Control Structures(控制结构). 二.Control Structures Scala中的控制结构与Java中的颇 ...
- R Programming week2 Control Structures
Control Structures Control structures in R allow you to control the flow of execution of the program ...
- Scala Control Structures
Scala之Control Structures 一.前言 前面学习了Scala的Numbers,接着学习Scala的Control Structures(控制结构). 二.Control Struc ...
- AOAPC I: Beginning Algorithm Contests -- Training Guide (Rujia Liu) Chapter 3. Data Structures Fundamental Data Structures
10410 这题说的是给了一棵多叉树的 bfs遍历轨迹 和dfs 遍历 轨迹 在父节点向叶子节点扩展的时候优先遍历编号较小的节点.我还原出这课树特殊判定 根据bfs的顺序来建立这课树,用一个队列安排要 ...
- Scala入门指南与建议
最近在学习使用Scala语言做项目,感觉这门语言实在是太优美了!作为一个本科数学.研究生机器学习专业的混合人才(哈哈),这门语言真的是满足了普通计算机编程(告诉计算机怎么做)和函数式编程(告诉计算机做 ...
- Core Java Volume I — 3.8. Control Flow
3.8. Control FlowJava, like any programming language, supports both conditional statements and loops ...
- Tutorial: WPF User Control for AX2012
原作者: https://community.dynamics.com/ax/b/goshoom/archive/2011/10/06/tutorial-wpf-user-control-for-ax ...
随机推荐
- Day049--jQuery的文档操作和事件介绍
今日内容 DOM操作(CRUD) js中DOM document.createElement('p') appendChild() insertBefore() removeChild() 创建元素 ...
- ElasticSearch6.5.0 【Java客户端之REST Client】
说明 High Level Client 是基于 Low Level Client 的.官方文档如下: * https://www.elastic.co/guide/en/elasticsearch/ ...
- springboot2 pagehelper 使用笔记
作者:cnJun 博客专栏: https://www.cnblogs.com/cnJun/ pom.xml <parent> <groupId>org.springframew ...
- DirectX11 With Windows SDK--08 Direct2D与Direct3D互操作性以及利用DWrite显示文字
前言 注意:从这一章起到后面的所有项目无一例外都利用了Direct2D与Direct3D互操作性,但系统要求为Win10, Win8.x 或 Win7 SP1且安装了KB2670838补丁以支持Dir ...
- 16、爬取知乎大v张佳玮的文章“标题”、“摘要”、“链接”,并存储到本地文件
爬取知乎大v张佳玮的文章“标题”.“摘要”.“链接”,并存储到本地文件 # 爬取知乎大v张佳玮的文章“标题”.“摘要”.“链接”,并存储到本地文件 # URL https://www.zhihu.co ...
- [Luogu P1144]最短路计数
emmmm这个题看起来非常复杂,实际上仔细一分析发现到一个点最短路的个数就是所有前驱最短路个数之和.如果在图上表示也就是以1为根的bfs搜索树,一个点的最短路个数等于每一个能够向它扩展的所有点的最短路 ...
- shell1
shebang = sharp-bang = #! 1.echo $PATH export PATH="$PATH:/home/user/bin" PREPEND prepend( ...
- MySQL学习10 - 多表查询
一.多表连接查询 1.交叉连接 2.内连接 3.外连接之左连接 4.外连接之右连接 5.全外连接 二.符合条件连接查询 三.子查询 1.带in关键字的子查询 2.带比较运算符的子查询 3.带EXIST ...
- Python3:几行代码实现阶乘
阶乘:一个正整数的阶乘(factorial)是所有小于及等于该数的正整数的积,并且0的阶乘为1.自然数n的阶乘写作n!. #---------------------------------- 阶乘- ...
- springboot集成elasticsearch遇到的问题
public interface EsBlogRepository extends ElasticsearchRepository<EsBlog,String>{ Page<EsBl ...