Thinking In Java 阅读笔记(三)

概念整理

在此将Thinking In Java中重要的知识点整理记录下来,其中很多都是不容易注意到的细节。
Java中基本数据类型在创建时都拥有初始值,具体如下:
类型名称 初始值
boolean false
char ‘\u0000’ (null)
byte (byte)0
short (short)0
int 0
long 0L
float 0.0f
double 0.0d

作用域
类成员变量总是要赋予初值
方法签名
import
参数转型
private和final可以防止继承

The increment operator is one explanation for the name C++, implying “one step beyond C.”
In an early Java speech, Bill Joy (one of the Java creators), said that “Java=C++--” (C plus
plus minus minus), suggesting that Java is C++ with the unnecessary hard parts removed,
and therefore a much simpler language. As you progress in this book, you’ll see that many
parts are simpler, and yet in other ways Java isn’t much easier than C++.

print("" + x); // Shorthand for Integer.toString()
Notice the last example in main( ): you will sometimes see an empty String followed by a +
and a primitive as a way to perform the conversion without calling the more cumbersome
explicit method (Integer.toString( ), in this case).

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容