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值。
TIJ——Chapter Three:Operators的更多相关文章
- TIJ——Chapter Two:Everything Is an Object
If we spoke a different language, we would perceive a somewhat different world. Ludwig Wittgenstein( ...
- TIJ——Chapter One:Introduction to Objects
///:~容我对这个系列美其名曰"读书笔记",其实shi在练习英文哈:-) Introduction to Objects Object-oriented programming( ...
- TIJ——Chapter Twelve:Error Handling with Exception
Exception guidelines Use exceptions to: Handle problems at the appropriate level.(Avoid catching exc ...
- TIJ——Chapter Eleven:Holding Your Objects
Java Provides a number of ways to hold objects: An array associates numerical indexes to objects. It ...
- TIJ——Chapter Eight:Polymorphism
The twist |_Method-call binding Connecting a method call to a method body is called binding. When bi ...
- TIJ——Chapter Seven:Reusing Classes
Reusing Classes 有两种常用方式实现类的重用,组件(在新类中创建存在类的对象)和继承. Composition syntax Every non-primitive object has ...
- TIJ——Chapter Five:Initialization & Cleanup
Method overloading |_Distinguishing overloaded methods If the methods hava the same name, how can Ja ...
- TIJ——Chapter Fourteen:Type Information
Runtime type information(RTTI) allows you to discover and use type information while a program is ru ...
- TIJ——Chapter Thirteen:Strings
String 对象是不可修改的,对于被String 重载的'+' 和'+=' 运算符来说,当你用它们来连接两个String 对象的时候,它在底层并不会对于每一次连接均生成一个String 对象,取而代 ...
随机推荐
- TZ_06_SpringMVC_常用注解
1. @Controller@RequestMapping(path = "/user")//一级目录 public class FormSubmit { @RequestMapp ...
- Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Persistence provider for EntityManager named null
swing Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Pe ...
- ifconfig命令为centos linux系统配置临时的局域名IP、网关以及子网掩码
ifconfig eth0 192.168.1.25 netmask 255.255.255.0 broadcast 192.168.1.1 up netmask:子网掩码broadcast:默认网关
- 2019.9.27 csp-s模拟测试53 反思总结
这个起名方式居然还有后续?! 为什么起名不是连续的?! T1想了半天,搞出来了,结果数组开小[其实是没注意范围].T2概率期望直接跳,后来翻回来写发现自己整个理解错了期望的含义[何].T3错误想到赛道 ...
- 洛谷P2429 制杖题 [2017年6月计划 数论10]
P2429 制杖题 题目描述 求不大于 m 的. 质因数集与给定质数集有交集的自然数之和. 输入输出格式 输入格式: 第一行二个整数 n,m. 第二行 n 个整数,表示质数集内的元素 p[i]. 输出 ...
- for循环取出每个i的值
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...
- ThinkPHP实现定时执行任务的两种方法 - 博客频道 - CSDN.NET
在平常的项目中我们总是会遇到需要将某个方法任务定时执行的问题,定时执行方法任务如果我们拥有服务器的权限,我们可以直接在服务器设置定时任务,例如在Windows的任务计划程序中进行设置,在Linux中编 ...
- SASS:sass语法参照列表及教程
http://sass-lang.com/documentation/file.SASS_REFERENCE.html 保存一下,上面的链接包括了scss中所有语法规则. 转载自:http://www ...
- webpack学习之—— Code Spliting(代码分离)
代码分离特性能够把代码分离到不同的 bundle 中,然后可以按需加载或并行加载这些文件.代码分离可以用于获取更小的 bundle,以及控制资源加载优先级,如果使用合理,会极大影响加载时间. 有三种常 ...
- perfcurve.m
function [X,Y,T,auc,optrocpt,subY,subYnames] = ... perfcurve(labels,scores,posClass,varargin) %PERFC ...