01. Avoid arbitrary use of static variables as far as possible
When an object is defined as a reference to a STATAIC variable, the GC usually does not reclaim the memory that the object occupies, such as:
1:public class a{
2: static b = b =
5. Transmission of data between different channel channel
In Java NiO, if one of the two channels is filechannel, then we can transfer the data directly from one channel to another channel. There are two different ways to transfer data between two
Arrays: The same type, encapsulated together with an identifier name, is an object sequence or a sequence of basic types of data.
Statement of one-dimensional array: 1 int[] A1; 2 int a1[]
Two formats are the same, the second is in line with C and C
The main reason to write this article is: Because, today's group of a small partner asked a question, and then we guessed for a long time, the data has problems, attributes have problems and so on. Finally found is a small error caused by the
Java introduces a new concurrency package in JDK1.5 java.util.concurrent the package is written specifically for Java processing concurrency.
The familiar use of multithreading in Java is in two different ways. Continue the thread class to implement
1. The creation of simple stored procedures:
1 The creation of a typical stored procedure in MySQL:
Delimiter
CREATE PROCEDURE Add (a int, b int, out sum int)
begin
Set sum = a + b;
End。。 Stored procedures are similar to functions and methods in C/
When Socketchannel is blocked (default is blocking mode) Read function, does not return 0, blocking mode of Socketchannel, if there is no data readable, or buffer full, it will block until the read conditions are satisfied, So the general blocking
Recently, the massive data analysis suddenly interest, plus the previous company has the need for a library, want to use multithreading to solve data query result set merge problem.
In the case of massive data, simple table partitioning has no way
Blocking queues: Thread safety
Sort elements by FIFO (first-in first out). The head of the queue is the element with the longest time in the queue. The tail of the queue is the element with the shortest time in the queue. The new element is inserted
Java string to determine the Chinese character and characters:
Package com.boco.synchrodata.util;
Public final class Stringutil {
/*** Judging Chinese characters and symbols based on Unicode encoding* @param c* @return*/private static Boolean
Such as:public class innerclassdemo{int x;Class a{static int a = 0;//It is illegal to write this way.static final int b=0;//It's legal to write this}}
Java class load order, the class is loaded first, the static variable is initialized, and then
PS: This article is my own Learning Java Network Programming notes recorded in the process, is a summary of what has been learned. Basic knowledge of network programming
The URL (uniform Resource locater) Uniform Resource Locator that represents
1, class and object difference, class is an object template, object is a class instance
2, create the syntax of the class class name {}, the class is composed of properties and methods
3, the creation of the syntax of the object:
· Declaring
All files in the JAVA Traversal folder (recursive calls and non-recursive calls)
1. Method calls that do not use recursion.
public void TraverseFolder1 (String path) {int filenum = 0, foldernum = 0;
File File = new file (path);
Stack and queue are two kinds of special linear tables, their logical structure and linear table are the same, but their operation rules are more limited than the linear table, so they call them the linear table with limited operation.
LinkedList
A, String class
To understand a class, the best way is to look at the implementation of this class source code, look at the string class Source:
Public final class String
implements Java.io.Serializable, Comparable, charsequence
{
/** The
JDK1.5 new features ==>>> character streams and byte stream differences, use scenarios, related classes ==>>> thread safety concepts, Several ways to implement thread safety ==>>> the difference between abstract classes and interfaces, the
There are many application classes in Java that define static methods to solve many common problems. The following are the top 16 application classes available through 50,000 open source project statistics. Classes are arranged by popular programs,
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