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 ...
随机推荐
- elk每日清除30天索引脚本
日常elk产生日志太多,故写个脚本放在定时任务,定时清理脚本 查询索引: curl -XGET 'http://127.0.0.1:9200/_cat/indices/?v' 删除索引: cu ...
- JavaScript数据类型 String字符串类型
前言 javascript没有表示单个字符的字符型,只有字符串String类型,字符型相当于仅包含一个字符的字符串 字符串String是javascript基本数据类型,同时javascript也支持 ...
- Regularity criteria for NSE 5: $u_3,\om_3$
In [Zhang, Zujin. Serrin-type regularity criterion for the Navier-Stokes equations involving one vel ...
- [再寄小读者之数学篇](2014-06-22 最大值点处导数为零的应用 [中国科学技术大学2012 年高等数学B考研试题])
设 $f(x)$ 在 $[0,1]$ 上连续, 在 $(0,1)$ 内可导, 且 $f(0)=f(1)=0$, $f\sex{\cfrac{1}{2}}=1$. 证明:对于任意的实数 $\lm$, 一 ...
- API.day01
第1部分 JDK API 1.1 API(Application Programming Interface,应用接口程序):已经封装好可以直接调用的功能(Java中以类的形式封装) 经常使用的JDK ...
- jpa返回List<Map<String, Object>>相当于jdbctemplate的queryForlist
public class Test(){ @PersistenceContext(unitName = "manageFactory") protected EntityManag ...
- [译]Ocelot - Routing
原文 Ocelot主要的功能就是将http请求转发到对应的下游服务上去. Ocelot将一个请求路由到另外一个路由的动作叫做ReRoute.为了能让Ocelot能正常工作,需要在配置中设置ReRout ...
- Codeforces 1060E(dfs计数)
题目链接 题意 给一棵树,对于一个节点,与它相邻的结点可以连一条边,求所有点对间距离之和 思路 任意两点间的距离被优化为$\left \lceil \frac{s}{2} \right \rceil$ ...
- Linux Socket I/O
Ref: 一文读懂Socket通信原理 幽默讲解 Linux 的 Socket IO 模型
- vue构造函数(根实例化时和组件实例对象选项)参数:选项详解
实例选项(即传给构造函数的options):数据,DOM,生命周期钩子函数,资源,组合,其他 数据 data 属性能够响应数据变化,当这些数据改变时,视图会进行重渲染. 访问方式: 1.通过 vm.$ ...