In Java SE 7, new binary notation is added, and you can use decimal notation to represent values in binary form as easily as possible.
For example:
A 8-bit byte value:
byte abyte = 0b100001;
A 16-bit short value: short
ashort = 0b10100101001
This article has shared a Java class that simulates ping, as follows
Import java.io.IOException;
Import java.net.InetAddress;
Import java.net.UnknownHostException;
/** * Created by Qiuju * on 2014/9/21.
* * Public class Simpleping
Automatic logon is to help users to use this page multiple times, without having to enter the username and password again to log in.
Automatic login refers to a user who saves the user's login information to a cookie in a local file.
This article illustrates the TCP transmission of Java implementation socket. Share to everyone for your reference. The specific analysis is as follows:
Client sends data to server
* TCP transmission, the process of client establishment.* 1, create
When you do a project, you need to "clean" the data you get, such as removing some ID numbers that are not possible. Check the Online ID card number verification algorithm, I also summed up.
(i) 18 identity card number structure
The citizenship
The example in this article describes how Java compares the values of two list to be equal. Share to everyone for your reference. Specifically as follows:
Suppose two queues {1,2,3,4} and {4,3,2,1}, this method is used to compare whether the values
Definition: An object should have minimal knowledge of other objects
The core idea of Dimitri law is decoupling between classes, weak coupling, only weak coupling, the reusability of class can be improved.
The analogy is similar to: prison inmates
This article describes the Java implementation httpclient asynchronous request resources. Share to everyone for your reference. The implementation method is as follows:
Package demo;
Import Java.util.concurrent.CountDownLatch;
Import
Definition: A client should not rely on interfaces that it does not need; A class's dependency on another class should be based on the smallest interface.The problem is: Class A relies on Class B via interface I, Class C through interface
Pass a request from the client to an object so that you can parameterize the customer with different requests. The decoupling of the behavior requester and the behavior performer enables loose coupling between the two to accommodate the change.
The Creates a successful string object whose length is fixed and cannot be modified and edited. Although you can use "+" to add new characters or strings, "+" produces a new instance of string that creates new strings objects in memory. If you
Single Responsibility Principle: a class that has only one cause for its change.
Why do we need a single responsibility principle?If a class has multiple reasons to modify it, then modifying a feature may cause other functions to produce bugs, so a
definition: defines a one-to-many dependency between objects so that when each object changes state, all objects that depend on it are notified and automatically updated.Type: behavior class patternclass Diagram:
In software systems, there is
Usually we surf the web site, often used to register the site. There are many ways, such as texting verification, email verification. Recently in the SSH framework, made a Simple mail send activation link to the mailbox, and then activate a
Overall effect:
Send end: NetEase mailbox, receiving end: QQ mailbox.
1.web Front End
2. In NetEase mailbox "sent" can see the message sent through the Java code
3. Also can see this kind of effect in QQ mailbox
Implementation
This article for everyone to share the Java regular expression matching, replacement, find and cut operations, interested friends can refer to the
Import java.util.ArrayList;
Import Java.util.regex.Matcher;
Import Java.util.regex.Pattern;
Often volatile in Java multithreaded programming, sometimes this keyword is confused with synchronized or lock, specifically resolves as follows: A member variable visibility problem exists in a multithreaded environment: There is a line stacks
The examples in this article describe the use of static methods in Java. Share to everyone for your reference, specific as follows:
static denotes "global" or "static" meaning, used to decorate member variables and member methods, or to form static-
No more nonsense to say, directly to everyone to paste the Java code.
Import java.io.IOException;
Import Sun.net.TelnetInputStream;
Import sun.net.ftp.FtpClient;
public class Myftp {
static ftpclient myftp;
static String hostname;
static
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