Discover java coding best practices, include the articles, news, trends, analysis and practical advice about java coding best practices on alibabacloud.com
Unified common coding methods and Java Web Coding
Unified format: (UTF-8 is not required, but must be unified)
JSP:
Servlet:
Request. setCharacterEncoding ("UTF-8"); // set the input encoding format.
Response. setContentType ("text/html; charsetType = gb2312"); // you can specify the output encoding format.
Database :/? UserUnicode = true characterE
Java Chinese garbled solution (4) ----- java coding conversion process, java ----- java
The first three blogs focus on character encoding. Through these three blogs, you will have a preliminary understanding of various character encoding methods, to understand the Chinese la
j2ee| Architecture Although many articles have discussed the best practice of Java EE. So, why do I have to write another article? What is the difference between this article and the previous article, or is it better than the other articles?
First, the target audience for this article is the architect who is working on the technology. To avoid wasting everyone's talents, I avoid telling banal best practices
Java Chinese garbled solution (6) ----- coding and decoding in java Web, java ----- javaWeb
In the previous blog, LZ introduced the java encoding and decoding operations in the previous two scenarios (IO and memory, in fact, in these two scenarios, we only need to set the co
Original Title: The CERT Oracle Secure coding standard for Java Author: (US) Fred long Dhruv mohindra Robert C. seacord Dean F. sutherland David Svoboda Translator: Ji Wenke Yang xiaochun book series name: Chapter Hua programmer library Publishing House: Machinery Industry Publishing House ISBN: 9787111428183 mounting time: June 2013 publication date: Opening: 16 open pages: 1 version: 1-1 category: more ab
multi-threading best practice, but it's double edge sword at same time. Lock interface is powerful but every power comes with responsibility. Different locks for Read and write operation allows to build scalable data structures like Concurrenthashmap, but it also Require lot of care during coding. Unlike synchronized keyword, thread doesn ' t release lock automatically. You need to call unlock () method to release a lock and the best practice are to
Article 3: JAVA character encoding Series 3: coding problems in Java applications this part adopts the reuse mechanism and references an article to complete this part. Source: Eceel Research -- character set encoding address: http://china.eceel.com/article/study_for_character_encoding_java.htm
1. Overview
This article mainly includes the following aspects: Basic
--Leverage advanced Java best practices to improve the architecture and design of existing and future Java EE applications
Author: Tarak Modi
Although many articles have discussed the best practice of Java EE. So, why do I have to write another article. What is the difference between this article and the previous ar
By using some assistive tools to find bottlenecks in the program, you can then optimize the code in the Bottleneck section. There are generally two scenarios: optimizing code or changing design methods. We generally choose the latter because it is better to improve the performance of the program than to call some optimized code without calling the following code. A well-designed program can streamline the code and improve performance.Here are some of the methods and techniques that are often use
());}
Alternatively, your code can return the clone of the exposed object.
Check local methodThe local method is a Java method, and its implementation is written in another programming language, such as C or C ++. Some developers implement local methods because the Java language is slower than many compiled languages even when using the real-time (just-in-time) compiler. Others need to use local code to i
"In-depth understanding of Java Virtual machines: JVM advanced features and best practices" PDF download Link:https://u253469.pipipan.com/fs/253469-230062566Content IntroductionAs a Java programmer, have you ever wanted to dig deeper into the Java virtual machine, but have been shut out of its complexity and profundity
system's file.encoding parameter (it is the operating system default encoding format, such as Win2K, which has a value of GBK), then the JDK translates our Java source program into memory from the file.encoding encoded format into the Java internal default Unicode format. And then Javac compiles the converted Unicode file into a. class file, at which point the. class file is Unicode encoded, it is temporar
1. Naming rules1.1 package naming rules
[Java-1]The package name should be written in small form and separated by "." In the middle [required]
Description · reason
Unless otherwise specified, make sure that the package name is written in small form. This is a general Java rule.
Example
Package CN. co. AAA. BBB; // ErrorPackage CN. co. AAA. BBB; // correct
[
Java file encoding tool and java coding Tool
This article mainly introduces a tool class written in java to convert a file encoding to another encoding that does not change the file content:
You can use URLEncoding to re-encode and decode the source file.
1 public class ChangeFileEncoding {2 public static in
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
circumstances to 8 screen around to display. This makes it difficult to read a program or modify a program. It is therefore advisable to extract the block that completes the comparison of independent functions as a single function. A block that accomplishes the same or similar function is extracted independently of a sub-function. It can be found that the simpler the upper-level function is, the more specific work is done by invoking a few sub-functions, the more the underlying function complet
By using some auxiliary tools to find bottlenecks in your program, you can optimize the code for the Bottleneck section. There are generally two scenarios: optimizing the code or changing the design method. We typically choose the latter because not calling the following code can improve program performance better than calling some optimized code. A well-designed program can streamline code to improve performance.
Some of the methods and techniques used in
executed across different JVM implementations or versions.
With JNI, the local code can interact with Java objects at will, obtain and design field values, and call methods, without being as limited as the same functions in Java code. This freedom is a double-edged sword: It sacrifices the security of Java code, in exchange for the ability to complete the tasks
Exception Handling is an important part of writing strong Java applications. It is a non-functional requirement of each application and is used to handle any error situations elegantly, such as resource unavailability, illegal input, and empty input. Java provides several exception handling features, using try, catch, and finally
Keywords are built in the language itself. The
Lambda best practices in Java 8 (1)
Java 8 has been launched for some time. More and more developers choose to upgrade JDK. The hot news shows that JDK 7 is the most popular, followed by JDK 6 and 8. This is a good thing!
In 8, Lambda is the most popular topic, not only because of changes in syntax, but more importantly, it brings the idea of functional programm
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.