TIJ英文原版书籍阅读之旅——Chapter Three:Operators

Operators

本章节比较简单,所以简单的做一些笔记:

几个要点:

1、When the compiler sees a String followed by a "+" followed by a  non-String, it attempts to convert the non-String into a String.

2、比较对象的内容使用equals()方法,前提是该对象所对应的类重写了 Object类中的equals()方法,并且实现了对对象内容进行比较。绝大多数 Java类库中的类都重写了equals()方法,因此它们比较的是对象的内容, 而不是引用。

3、You can’t use a non-boolean as if it were a boolean is a logical  expression as you can in C and C++.

4、一旦逻辑表达式的值能被确定为真或者假,那么逻辑表达式剩下的部分便不 在执行,我们称之为“短路原则”。

5、将float或者double值转换为整型值时,数字被截断。如果要四舍五入为 整型值,可以使用lang包中Math类的round()方法。

6、对小于整形的原生数据类型做数学运算或者移位操作,在执行操作之前他们 的值会自动提升为整形。一般地,表达式中的最大的数据类型是结果的类型。

7、除了boolean类型,任何两个原生数据类型之间都可以进行双向转换。

8、对于浮点数,没有特殊的指定(如:后缀f),编译器会将其看作double值。

时间: 2024-08-11 07:41:14

TIJ英文原版书籍阅读之旅——Chapter Three:Operators的相关文章

TIJ英文原版书籍阅读之旅——Chapter One:Introduction to Objects

///:~容我对这个系列美其名曰“读书笔记”,其实shi在练习英文哈:-) Introduction to Objects Object-oriented programming(OOP) is part of this movement toward using the computer as an expressive medium. This chapter will introduce you to the basic concepts of OOP, including an over

TIJ英文原版书籍阅读之旅——Chapter Two:Everything Is an Object

If we spoke a different language, we would perceive a somewhat different world. Ludwig Wittgenstein(1889-1951) You manipulate objects with references Although you treat everything as an object, the identifier you manipulate is actually "reference&quo

TIJ英文原版书籍阅读之旅——Chapter Five:Initialization & Cleanup

Method overloading |_Distinguishing overloaded methods If the methods hava the same name, how can Java know which method you mean? There's a simple rule : Each overloaded method must take a unique list of argument types. |_Overloading with primitives

TIJ英文原版书籍阅读之旅——Chapter Seven:Reusing Classes

Reusing Classes 有两种常用方式实现类的重用,组件(在新类中创建存在类的对象)和继承. Composition syntax Every non-primitive object has a toString() method, and it’s called in special situations when the compiler wants a String but it has an object. Inheritance syntax You’re always do

TIJ英文原版书籍阅读之旅——Chapter Eleven:Holding Your Objects

Java Provides a number of ways to hold objects: An array associates numerical indexes to objects. It holds objects of a known type so that you don't have to cast the result when you're looking up an object. It can be multidimensional, and it can hold

TIJ英文原版书籍阅读之旅——Chapter Eight:Polymorphism

The twist |_Method-call binding Connecting a method call to a method body is called binding. When binding is performed before the program is run(by the compiler and linker, if there is one), it's called early binding. You might not hava heard the ter

【资源分享】CLR.via.C#(第3版)英文原版+中文译本+随书代码

看完了<叩响C#之门>,并利用学到了知识解决了工作中的一个麻烦. 觉得C#没有想象中那么难,于是打算进一步学好它. 这几天在四处请教好书推荐. 毕竟对于我来说,没有那么多时间用来自己寻找教材. 有不少热心的朋友向我推荐了许多书籍,我也都一一找来看了看. 最终,我决定看<CLR.via.C#(第3版)> 它或许更适合我目前的阶段,而设计模式之类的对我来说还有点早. 中午在亚马逊买了中文版,但始终不太放心,觉得还是能有英文原版对照会更容易理解. 根据我的经验,有时候英文会比中文更好理解

《教父》中的经典台词以及英文原版

<教父>是我最喜欢的小说已经电影之一,在网上搜集了其中的经典台词和英文原版: Don't hate your enemy, or you will make wrong judgment.不要憎恨你的敌人,否则你将做出错误的判断. Don't let anybody know what you are thinking. 不要让任何人知道你在想什么. You make the choice, and this is your price. 你做出了这个决定,这是你的代价. Everything

暑假多看看英文原版电影

对于大多数的学生,暑假的到来,意味着可以好好的进行休息了,而在暑假中可以做的事情是很多的,放松或许是主要目的,但是也不要放弃学习的机会,暑假看英文原版电影则是这样的一种选择. 英文原版电影比中文配音的更具有观赏性,而且其纯英文的语境则是有利于学生从中学到一些英语知识的,也许只是只言片语,但也同样是收获的.在暑假这样的环境中,放松的去看几部经典的英文原版电影,既可以享受生活,有可以有新知识可以学习. 当然,仅仅看一遍这样的带字幕的原版电影,其对英语的熟悉还是不够的,最好可以同一部电影看上两遍,并对