Crazy Java: 16 lessons that break the basic skills of programmers

Source: Internet
Author: User

Crazy Java: 16 lessons that break the basic skills of programmers

Basic Information

Author: Li Gang
Press: People's post and telecommunications Press
ISBN: 9787115221681
Mounting time:
Published on: February 1, May 2010
Start: 16
Other Details View: http://www.china-pub.com/196647

Introduction

This book is another masterpiece by Li Gang, a famous java research expert, a Java language training master, and founder of crazy Java.
In this book, Mr. Li Gang has changed his boring teaching method, specifically for various learning problems that Java beginners may encounter, java memory management, common traps in Java programming, Java implementation of common data structures, and Java programming methods and experiences are discussed in detail.
These problems seem to be "common", but they are actually problems and problems that many beginners of Java will encounter at the beginner stage. In this book, Mr. Li Gang is trying to show readers the essence of these doubts and difficulties, so that readers can grasp the "internal power" of this language in an instant ".
This is not a manual that embraces all technical details, but a guide and guidance provided by the Java predecessors to the elders. Many of the content in this book is a reference for Mr. Li Gang and many of his students who have personally experienced it. This book carries the teachings of countless predecessors, and shows you a painful and happy Java World.

 

Directory

Lesson 1 array and memory control 1
1.1 array initialization 2
1.1.1 The Java array is static 2
1.1.2 do arrays need to be initialized? 5
1.1.3 initialization of basic type array 6
1.1.4 initialize the array of reference type 8
1.2 use array 11
1.2.1 The array element is variable 11
1.2.2 no multi-dimensional array 13
1.3 summary 18
2nd subject and memory control 19
2.1 instance variables and class variables 20
2.1.1 attributes of instance variables and class variables 21
2.1.2 instance variable initialization time 24
2.1.3 class variable initialization time 27
2.2 parent class constructor 29
2.2.1 implicit call and explicit call 29
2.2.2 access the instance variable 32 of the subclass object
2.2.3 method of calling quilt override 34
2.3 memory control for parent and child instances 36

. 2.3.1 Differences Between Inherited member variables and inherited Methods 36
2.3.2 In-memory subclass instance 39
2.3.3 class variables of parent and child classes 43
2.4 final modifier 44
2.4.1 final modified variable 44
2.4.2 execute the macro replacement variable 49
2.4.3 the final method cannot be rewritten. 53
2.4.4 local variables in the internal class 55
2.5 Summary 58
Section 3rd Implementation Details of common Java sets 59
3.1 set and map 60
3.1.1 relationship between set and map 60
3.1.2 hashmap and hashset 65
3.1.3 treemap and treeset 75
3.2 map and list 80
3.2.1 map values () method 81
3.2.2 relationship between map and list 87
3.3 arraylist and lifecycle list 88
3.3.1 differences between vector and arraylist 89
3.3.2 Implementation differences between arraylist and rule list 92
3.3.3 performance analysis and application scenarios of arraylist and rule list 96
3.4 iterator 96
3.5 Conclusion 100
Lesson 4th Java memory reclaim 101
4.1 types referenced by Java 102
4.1.1 The object is in the memory status of 102
4.1.2 strong reference 105
4.1.3 soft reference 105
4.1.4 weak reference 108
4.1.5 Virtual Reference 111
4.2 Java Memory leakage 112
4.3 garbage collection mechanism 116
4.3.1 garbage collection algorithm 116
4.3.2 collection of heap memory generation by generation 118
4.3.3 additional options for garbage collection 119
4.3.4 common garbage collector 120
4.4 tips for memory management 123
4.4.1 use 123
4.4.2 use stringbuilder and stringbuffer for string connection 123
4.4.3 release reference of useless objects as soon as possible 124
4.4.4 use static variable 124 as little as possible
4.4.5 avoid creating Java objects in frequently called methods and loops. 125
4.4.6 cache frequently used objects 125
4.4.7 try not to use the Finalize method 126
4.4.8 considering softreference 126
4.5 conclusion 126
Trap in expression 5th: 127
5.1 string traps 128
5.1.1 JVM processing of strings 128
5.1.2 immutable string 131
5.1.3 string comparison 133
5.2 expression type traps 135
5.2.1 automatic increase of expression type by 135
5.2.2 trap of compound assignment operators 136
5.3 traps caused by Input Methods 138
5.4 The annotated characters must be valid at 138
5.5 Escape Character trap 139
5.5.1 use the Unicode escape form of characters with caution: 139
5.5.2 abort the Escape Character 140 for line comments
5.6 possible errors caused by generics 141
5.6.1 assign a value of 141 to the original type variable
5.6.2 erasure 143 of the original type
5.6.3 trap 145 for creating a Generic Array
5.7 traps of Regular Expressions 147
5.8 multithreading trap 148
5.8.1 do not call the run method 148
5.8.2 static synchronization method 150
5.8.3 static initialization block starts a new thread to execute initialization 152
5.8.4 pay attention to the multi-threaded execution environment 157
5.9 conclusion 161
6th course Process Control traps 163
6.1 switch statement trap 164
6.1.1 will the default branch always run? 164
6.1.2 importance of break 165
6.1.3 switch expression type 167
6.2 tag-caused traps 168
6.3 If statement trap 169
6.3.1 conditions implied by else 169
6.3.2 careful empty statement 171
6.4 curly braces for the loop body 173
6.4.1 when can I omit curly braces 173
6.4.2 danger of omitting curly braces 174
6.5 for loop trap 175
6.5.1 what happened with semicolons: 175
6.5.2 careful cycle counter value 178
6.5.3 floating point number as the cyclic counter 179
6.6 foreach cycle counter 181
6.7 Conclusion 182
7th object-oriented traps 183
7.1 instanceof operator trap 184
7.2 constructor trap 188
7.2.1 void 188 before the constructor
7.2.2 create an object in the constructor 189
7.2.3 infinite recursion constructor 194
7.3 instances holding the current class 195
7.4 which overload method is called? 196
7.5 trap of method rewriting 199
7.5.1 rewrite the private method 199
7.5.2 method of rewriting other access permissions 200
7.6 Non-static internal class traps 201
7.6.1 non-static internal class constructor 201
7.6.2 non-static internal classes cannot have static members 203
7.6.3 subclass of non-static internal classes 204
7.7 static keyword 206
7.7.1 static methods belong to class 206
7.7.2 static internal class limit: 207
7.8 native method traps 208
7.9 conclusion 209
8th traps for exception capturing 211
8.1 correct method of disabling resources 212
8.2 finally Block Traps 215
8.2.1 finally execution Rule 215
8.2.2 Finally block and method return value 217
8.3 Catch Block usage 219
8.3.1 order of catch blocks: 219
8.3.2 do not use catch instead of process control 221
8.3.3 only catch exceptions that may be thrown 221
8.3.4 actual repair 225
8.4 inheritance exception 227
8.5 conclusion 228
Lesson 1 linear table 9th
9.1 linear Table Overview 230
9.1.1 linear table definition and logical structure 230
9.1.2 basic operations on a linear table 231
9.2 sequential storage structure 231
9.3 chain storage structure 236
9.3.1 basic operations on a single-chain table: 237
9.3.2 circular linked list 243
9.3.3 two-way linked list 244
9.4 linear table analysis 251
9.4.1 Implementation Analysis of linear tables 251
9.4.2 functions of a linear table 251
9.5 conclusion 252
10th course stack and queue 253
10.1 stack 254
10.1.1 basic stack definition 254
10.1.2 stack common operations 254
10.1.3 stack sequence storage structure and implementation 255
10.1.4 stack chain storage structure and implementation 259
10.1.5 stack 263 in the Java Collection
10.2 queue 263
10.2.1 basic definition of a queue 263
10.2.2 queue Common Operations 264
10.2.3 sequential storage structure and implementation of queues 264
10.2.4 circulating queue 268
10.2.5 queue chain storage structure and implementation 272
Queue 275 in the 10.2.6 Java set
10.3 bidirectional queue 276
10.4 conclusion 278
11th course tree and binary tree 279
11.1 tree overview 280
11.1.1 tree definition and basic terms 280
11.1.2 basic tree operation 281
11.1.3 expression of parent node 282
11.1.4 subnode chain representation 286
11.2 Binary Tree 290
11.2.1 Binary Tree definition and basic concepts 290
11.2.2 basic binary tree operation 292
11.2.3 sequential storage of Binary Trees 292
11.2.4 Binary Tree binary linked list storage 296
11.2.5 triplicate chain table Storage of Binary Trees 299
11.3 traverse Binary Tree 303
11.3.1 first traverse 303
11.3.2 sequential traversal 304
11.3.3 post-order traversal 304
11.3.4 breadth first (by layer) traversal 305
11.4 transition of forests, trees, and Binary Trees 306
11.4.1 forest, tree, and binary tree conversion 306
11.4.2 tree linked list storage 307
11.5 Harman tree 307
11.5.1 definitions and basic concepts of the Harman tree 307
11.5.2 create a user tree 308
11.5.3 Harman coding 311
11.6 sorting Binary Tree 312
11.7 red/black tree 319
11.7.1 insert operation 321
11.7.2 delete operation 322
11.8 conclusion 332
12th common internal sorting 333
12.1 basic concepts of sorting 334
12.1.1 sorting overview 334
12.1.2 classification of internal sorting 335
12.2 select sorting method 335
12.2.1 directly select sorting 335
12.2.2 heap sorting 339
12.3 exchange sorting 343
12.3.1 Bubble Sorting 343
12.3.2 quick sorting 345
12.4 insert sort 347
12.4.1 insert sort 347 directly
12.4.2 semi-insert sorting 349
12.4.3 shell sorting 351
12.5 merge and sort 353
12.6 bucket sorting 357
12.7 base sorting 359
12.8 conclusion 362
Course 1 program development 13th
13.1 solid basic skills 364
13.1.1 fast Input Capability: 364
13.1.2 programming capability: 365
13.1.3 fast troubleshooting 366
13.2 before Program Development 366
13.2.1 component model of analysis software 366
13.2.2 build a software data model 369
13.3 clarify the specific implementation of the Program 370
13.3.1 how to communicate with each component 370
13.3.2 Implementation of Human-Computer Interaction 372
13.3.3 analysis of complex algorithms 374
13.4 compiling development documents 377
13.4.1 draw a modeling diagram and flowchart 377
13.4.2 brief description 378
13.4.3 write a pseudo code to achieve 379
13.5 coding implementation and development mentality 379
13.5.1 development is complex 379
13.5.2 the development process is long 380
13.6 conclusion 380
14th program debugging 381
14.1 program debuggable 382
14.1.1 Add Comment 382
14.1.2 use Log 382
14.2 basic methods for program debugging 390
14.2.1 code review with compiler 390
14.2.2 Tracking Program Execution Process 392
14.2.3 breakpoint debugging 394
14.2.4 isolation debugging 395
14.2.5 error reproduction 397
14.3 record Common Errors 398
14.3.1 possible causes of Common exceptions 399
14.3.2 common causes of exceptions during running 400
14.4 overall program debugging ideas 402
14.4.1 segmented debugging 402
14.4.2 module debugging 403
14.5 debugging mentality 403
14.5.1 error 403
14.5.2 debugging takes 404 more time than program writing.
14.6 conclusion 404
Lesson 15th using ide tools 405
15.1 when to start using ide tools 406
15.2 ide tool overview 407
15.2.1 basic functions of IDE 407
15.2.2 common Java ide tools 409
15.3 project management 412
15.3.1 Create Project 412
15.3.2 automatic compilation 416
15.3.3 automatic deployment and operation 417
15.4 code management 418
15.4.1 wizard code generation 418
15.4.2 code generator 420
15.4.3 code prompt 421
15.4.4 Automatic Code Completion 422
15.4.5 real-time error 422
15.5 project debugging 423
15.5.1 set the breakpoint 424
15.5.2 single-step debugging 426
15.5.3 step into and step out 426
15.6 team collaboration 427
Client 428 as a version control tool
15.7 conclusion 431
Lesson 1 software testing 16th
16.1 software testing overview 434
16.1.1 concepts and objectives of software testing 434
16.1.2 classification of software testing 436
16.1.3 development and testing activities 436
16.1.4 common bug management tools 437
16.2 unit test 438
16.2.1 unit test overview 438
16.2.2 unit test logic coverage: 439
16.2.3 about JUnit 442
16.2.4 usage of JUnit 443
16.3 system testing and automated testing 448
16.3.1 overview of system testing 448
16.3.2 automated testing 449
16.3.3 common automated testing tools: 450
16.4 Performance Testing 451
16.4.1 Performance Testing overview 451
16.4.2 concepts related to performance testing 452
16.4.3 common performance testing tool 453
16.5 conclusion 453

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.