For programming languages, a good coding style can not only generate effective framework encoding at the beginning of programming, but also make our coding clearer and more standardized. However, as mentioned by the author in this article, although the coding style of some Java programs is widely used, it will have a n
Java coding specification (1)-General Linux technology-Linux programming and kernel information. For details, see the following section. 2. File Names)
This section lists common file names and their suffixes.
2.1 File suffix (File Suffixes)
Java programs use the following file suffixes:
File category file suffix
Java s
This is a list of 10 more refined Java coding practices than Josh Bloch's valid Java rules. Compared to the list of Josh Bloch, which is easier to learn and focus on daily situations, this list will include uncommon situations involving API/SPI design and may have a great impact.
I have encountered this in writing and maintaining jOOQ (SQL for internal DSL Modeli
Coding | Problems Java language default encoding is Unicode, and we Chinese commonly used files and databases are based on GB2312 or BIG5 encoding, how to properly select the encoding method and correctly handle the Chinese character encoding? This article will start with encoding common sense, combine Java programming example, analyze above two questions and pro
has been trying to figure out the coding problem in Java, but also read some articles on the internet, but still foggy. It was not until recently that I saw Fanglixun's web course that I understood a little.Keep a record of your understanding and see if you can be clear about it.
The first question: I define a string in Java code, what is it encoded?
design in Java 2, there is still a consistent development that only helps developers to meet their needs:Part 1Part 2
"Statically scanning Java code for security vulnerabilities" (IEEE software, September 2000) co-authored by John viega, Tom mutdosch, Gary McGraw, and Ed Felten introduced a Java tool, you can use this tool to check security vulnerabilities in yo
The following page, too let me tangled, who can help adjust a bit, ..._________________Java-jar Test.jar "121"In this way, "121" if printed out, it will be garbled, you can add a-dfile.encoding=utf-8 to specify the parameters as what character encoding incoming.Java-dfile.encoding=utf-8-jar Test.jar "121"In this way, the Java code in the printed out is not garbled.Other than that: string represents a UTF-16-formatted string in which the supplementary
Java is Google's coding style guide... this is awesome. We will provide you with a pdf version of the first version. If you have money, please buy the second version of the genuine version.
There are also several Java-related coding styles that actually come from Google for reference:The encoding style recommended by
{//ensure the arrays is of equal size ...}9) ToString methodIn general, each class should define a ToString method:Public String toString () {...}) Main methodGeneral class, consider placing a main () method that contains the code used to test the class, and if it contains the main () method, it should be written at the bottom of the class.4. Java Coding Other ConventionsN DocumentationYou must use Javadoc
Java coding in JS
In the current web applications, more and more page elements are operated by js, especially when an asynchronous request is initiated by js, encoding problems often occur. The following describes the Encoding Problems in js.1. Introduce js files externally
Contains string input in a separate js file, for example:
If a script. js script is introduced, the script contains the following code
member variable: Need to use GET, set method read, setting9.2. Important or repetitive expressions or methods should be extracted.9.2. Exception handling: Do not ignore any exception information. If you want to track more advanced exceptions, do not ignore the lower level exception information.9.3. Release resources: If you need to release resources, you need to put them in a finally block.Other references:Http://www.oracle.com/technetwork/java/codec
Causes of Java coding and Solutions
I. file encoding
Unicode is the preferred encoding. Unicode is a global character encoding standard.
Conclusion: the conversion between GBK and unicode is performed through the gbk unicode ing table.
The conversion between UTF-8 and unicode is based on the Conversion rule Formula
Therefore, unicode is the core intermediary. To convert Gbk to UTF-8, convert it to unicode
Java coding specification (2)-General Linux technology-Linux programming and kernel information. For details, see the following section. 6.3 Placement)
Declare variables only at the beginning of the code block. (A block refers to any code contained in braces "{" and .) Do not declare the variable when it is used for the first time. This will confuse unfocused programmers and impede code portability in this
, int[] R3, int[] R4) throws illegalargumentexception{Ensure the arrays is of equal size......}9) ToString methodIn general, each class should define a ToString method:Public String toString () {...}) Main methodGeneral class, consider placing a main () method that contains the code used to test the class, and if it contains the main () method, it should be written at the bottom of the class.4. Java Coding
:111110XX 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxxu-04000000-u-7fffffff:1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxxThe position of XXX is filled in by a bit of the binary representation of the character encoding number. The more the right x has the less special meaning. Use only the shortest multi-byte string that is sufficient to express the number of characters encoded. Note In a multibyte string, the number of "1" at the beginning of the first byte is the number of bytes in the entire st
we call the second position, the encoding in the page encoding declaration should be the same as the encoding used when the Web page file was saved.
and the browser's coding settings are actually not strict, as we said in the third section, in the browser choose to use GB2312 to view, it will actually still use GBK. And the browser also has the good habit, that it will try to guess what to use the code to see the most appropriate.
I would like to r
The norm needs to be noticed in the regular coding process, which is a good habit to develop slowly.1. Basic PrinciplesMandatory principle:1. The StringBuilder of the string must be used;The use of 2.try...catchTry {}catch{Exception e e.printstacktrace ();} finally {}// can be used in the outermost action, all other places are forbidden to use;Try { // program code }catch(Exception e) { // is empty, nothing is written } // prohibit use in any
software system structure.The tighter the connection between the modules, the stronger the couplingThe module's independence is worse.The coupling between modules depends on the complexity of the interface between modules, the mode of invocation and the information transmitted. Coupling and cohesion are the two qualitative standards of module independence, when the software system is divided into modules, it is possible to achieve high cohesion and
in this article, the Java Advisor Dennis Sosnoski compares the performance and functionality of several Java document models. When choosing a model, it is not always easy to make trade-offs, and if you change your mind later, you need a lot of coding to switch. The author puts the performance results
Learn Java for a few months, has been to public,private,protected,static,final keyword and with each other not too concerned about, today read the "Java Security coding standards" only to find the severity of the problem.Code that does not conform to the rule:A data member of the underlying data type of public (common)
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.