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值。

TIJ——Chapter Three:Operators的更多相关文章

  1. TIJ——Chapter Two:Everything Is an Object

    If we spoke a different language, we would perceive a somewhat different world. Ludwig Wittgenstein( ...

  2. TIJ——Chapter One:Introduction to Objects

    ///:~容我对这个系列美其名曰"读书笔记",其实shi在练习英文哈:-) Introduction to Objects Object-oriented programming( ...

  3. TIJ——Chapter Twelve:Error Handling with Exception

    Exception guidelines Use exceptions to: Handle problems at the appropriate level.(Avoid catching exc ...

  4. TIJ——Chapter Eleven:Holding Your Objects

    Java Provides a number of ways to hold objects: An array associates numerical indexes to objects. It ...

  5. TIJ——Chapter Eight:Polymorphism

    The twist |_Method-call binding Connecting a method call to a method body is called binding. When bi ...

  6. TIJ——Chapter Seven:Reusing Classes

    Reusing Classes 有两种常用方式实现类的重用,组件(在新类中创建存在类的对象)和继承. Composition syntax Every non-primitive object has ...

  7. TIJ——Chapter Five:Initialization & Cleanup

    Method overloading |_Distinguishing overloaded methods If the methods hava the same name, how can Ja ...

  8. TIJ——Chapter Fourteen:Type Information

    Runtime type information(RTTI) allows you to discover and use type information while a program is ru ...

  9. TIJ——Chapter Thirteen:Strings

    String 对象是不可修改的,对于被String 重载的'+' 和'+=' 运算符来说,当你用它们来连接两个String 对象的时候,它在底层并不会对于每一次连接均生成一个String 对象,取而代 ...

随机推荐

  1. CSS3画图

    众所周知,用CSS3的圆角.转换可以画出各种不同的形状,制作不同的图案,早些前先驱者已画出经典的叮当猫,iphone手机等展示CSS3的强大实力,趁最近有空我也对CSS3进行了一些实践,颇有收获. 用 ...

  2. Leetcode476.Number Complement数字的补数

    给定一个正整数,输出它的补数.补数是对该数的二进制表示取反. 注意: 给定的整数保证在32位带符号整数的范围内. 你可以假定二进制数不包含前导零位. 示例 1: 输入: 5 输出: 2 解释: 5的二 ...

  3. 谷歌浏览器flash被禁用解决方法

    谷歌浏览器访问设置:chrome://settings/content/flash 把要启动flash插件的网址添加进去

  4. PHP--Button按钮没有设置type类型,默认会提交表单

    例如: <from > <input type='submit' value='提交'></input> <button >提交</button& ...

  5. [转载]C语言EOF是什么?

    原贴网址:http://www.kuqin.com/language/20111112/314745.html 收藏于此: 我学习C语言的时候,遇到的一个问题就是EOF. 它是end of file的 ...

  6. nginx 限制ip的请求频率

    需要注意,这个很容易误伤 还需要结合别的办法进行共同配置 总是有人很清闲的扫我的网站 ,所以要限制一下了 先来看看没有限制的时候,并发10 100次 服务器一直在正常响应  限制一下,之后再测试一下 ...

  7. Could not parse mapping document from resource com/hs/model/StudentModel.hbm.xml

    网上出现这个问题的 lei.hbm.xml配置写错的,文件头应该改为如下,并不是这个问题 <?xml version="1.0"?> <!DOCTYPE hibe ...

  8. Win7下设置WiFi热点

    Win7下设置WiFi热点 今天研究了下Win7设置WIFI热点,Connectify神马的都是浮云~亲測可用,现拿出来分享下~ 1.点击"開始",再点击"执行" ...

  9. python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”

    安装了python2,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'gecko ...

  10. hive如何配置支持事务及insert、update、delete

    Hive从0.14版本开始支持事务和行级更新,但缺省是不支持的,需要一些附加的配置.要想支持行级insert.update.delete,需要配置Hive支持事务. 一.Hive具有ACID语义事务的 ...