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. LINUX用户身份切换

    Su 命令作用 su的作用是变更为其它使用者的身份,超级用户除外,需要键入该使用者的密码. 使用方式 su [-fmp] [-c command] [-s shell] [--help] [--ver ...

  2. niec-validator 表单验证使用案例

    css .msg-box span { font-size: .5rem; color: #7699c6; } .msg-box .tip { padding-left: 18px; backgrou ...

  3. 关于 matplotlib

    注意,需要 zlib, 需要 Tkinter pip install matplotlib import numpy as np import matplotlib.pyplot as plt plt ...

  4. .NET框架之---MEF托管可扩展框架

    MEF简介: 今天学习了下MEF框架,MEF,全称Managed Extensibility Framework(托管可扩展框架).MEF是专门致力于解决扩展性问题的框架,MSDN中对MEF有这样一段 ...

  5. Cannot allocate memory for the buffer pool

    优化了一通,启动不了 直接上日志 innodb_buffer_pool_size”.”key_buffer_size” 的大小设置,适当的调大内存分配,减小,然后保存配置文件,重新尝试启mysql 成 ...

  6. python学生管理系统

    import osimport re #获取本机用户名,构建student.txt文件名创建在左面import getpassusername=getpass.getuser()print(" ...

  7. Java中用JXL导出Excel代码详解

    jxl是一个韩国人写的java操作excel的工具, 在开源世界中,有两套比较有影响的API可供使用,一个是POI,一个是jExcelAPI.其中功能相对POI比较弱一点.但jExcelAPI对中文支 ...

  8. 2019-8-31-dotnet-Framework-源代码-类库的意思

    title author date CreateTime categories dotnet Framework 源代码 类库的意思 lindexi 2019-08-31 16:55:58 +0800 ...

  9. 优化 Tengine HTTPS 握手时间

    背景 网络延迟是网络上的主要性能瓶颈之一.在最坏的情况下,客户端打开一个链接需要DNS查询(1个 RTT),TCP握手(1个 RTT),TLS 握手(2个RTT),以及最后的 HTTP 请求和响应,可 ...

  10. ScrollView 实现子视图滑动到顶部时固定不动

    这个,个人建议使用自己写的布局使用view的gon或者visble的方法,使用design包中的控件来的话,局限性很大 方法有倆 (1)自定义ScrollView 重写ScrollView 的 com ...