Links: https://pan.baidu.com/s/1dldhw_fY3mwaO5Wj6DeaXw
Extraction code: wt9k
table of Contents
1 Quick Start 1
1.1 Introduction 1
1.2 write your first Hello World program 3
1.3 Program Structure 10
1.3.1 Kotlin source structure 10
1.3.2 package declaration and import 11
1.3.3 extension 14
1.4 Kotlin standard library 14
2 19 basic syntax
2.1 Basic Types 19
2.1.1 Digital 20
2.1.2 string 23
2.2 Variables and Constants 24
2.2.1 Constant 24
2.2.2 Properties Packaging 25
Function 30 2.3
30 2.3.1 function declaration
35 2.3.2 Closure
2.3.3 lambda expressions 40
2.3.4 the inline function 54
Package 3 58
3.1 constructor of Example 60
3.1.1 Talk constructor 60
3.1.2 Kotlin constructor 62
3.1.3 simplified primary constructor 63
3.1.4 two constructor 66
3.1.5 C ++ constructor parameter list with 69
3.1.6 default constructor of the cover 71
3.1.7 Constructors access to the default 73
75 3.2 Memory Allocation
3.2.1 JVM memory model 75
3.2.2 class meta-information 80
3.2.3 Creating a class instance 87
3.3 Initialization 89
3.3.1 Automatic Initialization builder with 89
3.3.2 member variable initialization 90
Initialization 3.3.3 init {} 92
3.3.4 initialization statement 96
3.3.5 initialization sequence 98
3.4 class member variables 103
3.4.1 initial value 103
3.4.2 Access 111
115 3.5 Array
3.5.1 Array interface declaration by an array of 116
3.5.2 array of read and write 119
3.5.3 declare a reference array 120
3.5.4 Using other methods to declare an array of 123
3.5.5 multidimensional array 129
3.5.6 Array and list converter 131
3.6 static function along with 132 objects
3.6.1 along with 133 objects
3.6.2 Title omitted instantiation 135
3.6.3 accompanying object properties 136
3.6.4 along with the object initialization 137
3.6.5 accompanied principle object 139
3.6.6 anonymous class 145
Inheritance 149 4
4.1 inherits the basic concept 149
4.1.1 inheritance syntax 149
4.1.2 Interface 152
4.1.3 virtual class 165
4.2 Multiple Inheritance 168
168 4.2.1 Multiple inheritance of classes and interfaces
4.2.2 Constructors inherited 170
4.2.3 Multiple Inheritance 174 interface method
4.3 Inheritance initialization 176
4.4 Type Conversion 179
Over five states 183
5.1 183 concept
5.1.1 rewrite 184
5.1.2 Overload 185
5.2 extension 189
5.2.1 The concept 189
5.2.2 Kotlin extension 191
5.2.3 Extension and heavy-duty 193
5.2.4 Extended Functions 196 polymorphism
5.2.5 Extension Principle function 201
5.2.6 attribute extension 203
204 5.3 operator overloading
5.3.1 Kotlin 205 of operator overloading
5.3.2 operator overloading by extension function 207
5.3.3 Principle 208 operator overloading
5.3.4 operator overload limit 209
5.3.5 infix operators 211
And transmitting the pointer 212 5.4
Type and transmission 213 5.4.1 Java
5.4.2 by value / reference terminator 216
5.4.3 this pointer 218
5.4.4 class function call mechanism and this 222
6 Kotlin specific I / O 224
6.1 Java I / O library 224
6.2 Kotlin I / O library 231
6.3 Termination I / O 234
6.4 Bunken I / O 237
6.5 File Compression Example 239
6.6 serialization 241
6.6.1 Kotlin serialization 242
6.6.2 Sequence Control 245
7 Kotlin mechanism 247
7.1 function definition 247
7.1.1 top-level function 247
7.1.2 the inline function 250
7.2 variables and attributes 257
Packing 257 7.2.1 Properties
7.2.2 Lazy Initialization 261
7.2.3 let syntactic sugar 264
7.3 class definition 266
7.3.1 Java inner class 267
7.3.2 Kotlin classes 272
7.3.3 Kotlin class properties and methods of access to the top 274
Member variables 276 7.3.4 Kotlin class
7.3.5 singleton object 279