原创 《JAVA編程思想》學習備忘(第93頁:Operators--1)
在最底層,數據在Java中靠運算符來控制。 Simpler print statements 以下爲簡化了的打印語句包及方法,使用時可導入包: | package staticPrint; | public class
原创 《JAVA編程思想》學習備忘(第61頁:Everything Is an Object--1)
“If we spoke a different language,we would perceive a somewhat different world” 此爲本章開篇引言,大意:如果我們使用另類的語言,我們將追尋一個
原创 《JAVA編程思想》學習備忘(第93頁:Operators--3)
續《JAVA編程思想》學習備忘(第93頁:Operators--2) Common pitfalls when using operators 運算符使用中的“陷井” 一個Java中的錯誤例子: while(x=y){ //..
原创 《JAVA編程思想》學習備忘(第61頁:Everything Is an Object--2)
(接Everything Is an Object--1) You never need to destroy an object 本小節介紹Java中的垃圾清理工作。 Scoping 範圍(作用域),在Java中用一對
原创 《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)--2
The this keyword The this keyword-which can be used only inside a non-static method-produces the reference to the obj
原创 《JAVA編程思想》學習備忘(p61:Everything Is an Object--3)
(接Everything Is an Object--2) Methods,arguments,and return values Methods in Java determine the message an object can r
原创 《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)--1
As the computer revolution progresses,"unsafe" programming has become one of the major culprits that makes programming
原创 《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-4
續《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-3 The meaning of static 靜態的含義 With the this keyword in mind,you can mo
原创 《JAVA編程思想》學習備忘(第93頁:Operators--2)
續《JAVA編程思想》學習備忘(第93頁:Operators--1) Short-circuiting 使用邏輯運算符時的“短路”現象:在並列邏輯判斷項運算過程中得到的值如可明確爲最終結果,其後的邏輯運算將不執行。 舉個例子:
原创 《JAVA編程思想》學習備忘(第135頁:Controlling Execution)
Controlling Execution Like a sentient creature,a program must manipulate its world and make choices during execution.
原创 《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-3
續《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-2 Calling constructors from constructors When you write several constu
原创 《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-5
續《JAVA編程思想》學習備忘(第155頁:Initialization & Cleanup)-4 Member initialization 如果一個類中的屬性爲原始數據類型,它將會確保有一個初始值。以下程序爲一例證: import s