One, actually very simple:
double dou = 3000.533
dou = (double) Math.Round (dou*100)/100
where Dou is a variable, it's easy, most of us know Math.Round ( method, but I didn't expect to keep two decimal digits is multiplied by 100 and then divided by.
A brief description: The use of Java NIO to develop network communication is relatively fast and aspect. Because he can listen to client connections without blocking, the event-based mechanism can be used in Java NiO for non-blocking communication
Package jack.test; /** * Sometimes look at the open source framework can learn a lot of useful things, see the simple log when you find a writing * in the Boolean operation can be used |= or &= or ^= operations. * Logical operator * The Operation
1. A lot of email from the client, the actual application of the actual value of the small, real life is the most used in the Web page to send email function, here, such as a Web application with the mail delivery function.
2. The following is an
package file;
Import Java.io.File;
Deletes all files in the specified path, and all folders in the folder, excluding the folder public
class Filedel {public
static void Delallfiles (file file,string Singal) {
if (!file.exists ())
If you use the spring plug-in to create a spring template project, it defaults to log4j, as long as you change the log4j configuration to use, if you create a project, you need to load the log4f package, use the following steps
1.pom.xml join
Single State mode
It is not strange that public class Singleton {private Singleton () {}//define yourself an instance within yourself. Note that this is private only for internal calls private static Singleton instance = new Singleton (); This
Here is a "finger-round" example to illustrate the principle of adapter mode and simple application, this example from Java and schema.
1. Class Diagram
2. Java Implementation CodePackage cn.edu.ynu.sei.adapter;
/**
* Sphere Interface
*
For debugging purposes, we need to print the method name as well as the current PID and Tid. Here's one way:
First, import android.os.Process, and then, where needed, print:
Import android.os.Process;
...
LOG.V (TAG, New Exception ().
A memory leak means that an object or variable that is no longer being used by a program is occupied in memory. Java has a garbage collection mechanism that ensures that an object is no longer referenced, that is, when an object becomes orphaned,
1. Throw an exception
exceptions thrown by the Java run-time system
manually created and thrown as needed
artificially throwing an exception (must be thrown as an object of Throwable or its subclasses)
syntax Format: Throw exception class
Reference: Deep analysis of Java in the boxing and unboxing;The use of buffering mechanisms in Java for basic data types and wrapper classes in the interchange;Java Learning notes: Boxing and unboxing, wrappers and buffer poolsJava various types of
I. Situations where duplicate submissions may occur in the project:
1, repeatedly click the Submit button due to slow server or network latency.
2, has been submitted successfully, refresh the Success page (forward).
3, has been submitted
For:
Enum Color {Red,blue,black Yellow,green};
(1) ordinal () method: Returns the order of enumerated values in the enumeration class. This order depends on the order in which the enumeration values are declared.Color.RED.ordinal (); Return Result:
Java Development often uses a limited number of constants, which can be defined within the bean as an enum type, so in the maintenance of more convenient to control, so here is a simple record of the definition and usage of enum, convenient for
Hessian VC + + client and Java server-side communication implementation
Recently encountered a project, need to communicate with the Java server side, the Java server uses the protocol is Hessian. Have not heard, Google to find its official website
First, the XML foundation
1. As a general Data Interchange Format, XML is used more and more widely. Many of the current system's configuration files are in XML format. A configuration file is a file that records configuration information for an
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