1 code style and habits

Java:

// The difference between if (null == userNumber) and if (userNumber == null)
if (userNumber == null) {
         // It's easy to write if (userNumber = null), but it won't be reported when compiling, it's not convenient when checking for errors.
}
if (null == userNumber) {
         // And this is very straightforward, because if (null = userNumber) is reported in Java, so it's easy to find.
}

 

Intelligent Recommendation

Remember the code habits

1. Protected attributes usually underline_ As a prefix, this is just a simple agreement, which is not forced, that is, it should not access this type of properties and methods from the outside. 2, pri...

Logic habits in some code

Code logic habits or some small operations (own notes) 1. Requires an array or the current element of the string and the previous element to do related operations: Directly traverse this sequence, whe...

Business code habits

Business code habits Be sure before performing for loops, do not let NULL data or collections for FOR cycle Printing the log for the incoming value, the income parameters of the method are also printe...

Develop good code habits

Table of contents 1. Be sure to write a comment 2. Be sure to add a log 3. Java method where you need to pay attention 1. Be sure to write a comment Recommended xxx scenes of the note format, XXX oper...

Code style (1) - naming convention

First, the naming convention The most important consistency rule is naming management. The naming style allows us to quickly understand the meaning of a name without having to look up the type declara...

More Recommendation

ES6 code programming style (1)

1. Block -level scope 1.let and const replaced VAR The LET declaration variable will not be hung in Window, and will not cause global pollution; let new add -level agglomeration scope; let is not allo...

c language - improve articles (habits, style)

1, writing method 1:if('A'==a) { a++; } writing 2;if(a=='A') { a++;} Writing 1 is better. If "==" is mistakenly written as "=", the compiler does not allow you to evaluate the erro...

Java coding style: space usage habits

Coding style: space usage habits What is the personal coding style? An example is as follows: Test0523.java What is the personal coding style? When I read the book, I suddenly found out that there wer...

1. make their own habits C ++

Accustoming Yourself to C++ Terms 01: as C ++ is a language federal View C++ as a federation of languages. Efficient C ++ Programming Code, as the situation varies, depending on which part of your use...

1, let yourself habits C ++

Terms 01: Visual C ++ is a language federal C ++ can be understood as a combination of four times: C. Basic blocks (Statements, predussor, build-in data types), arrays, pointers, etc. come from C Obje...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top