Student Class Student:
Cloning clone clone package;
/* To clone must implement this excuse: cloneable, to mark this object can be cloned
cloneable: This class implements the Cloneable interface to indicate that the Object.clone () method
Polymorphism in the thinking in JAVA3
People are often confused by, non-object-oriented features to Java, like method overloading, which are sometimes pre sented as object-oriented. Don ' t be fooled:if it isn ' t late binding, it isn ' t
Understanding of Serializable and parcelable
1, the first of their two interfaces are to achieve the serialization of objects, so that it can be passed, the so-called serialization is to replace the object information can be stored in the process
There are four of escape characters in Java:
Java literal characters:
1. Eight binary escape sequence: + 1 to 3 digits 5 digits; Range ' 00 ' ~ ' 377 ': null character
2.Unicode escape Character: U + four hexadecimal digits; 0~65535u0000: null
Copy Code code as follows:
import Java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.List;
import Java.util.Scanner;
public class Josephus {
private static Class node{
int No;
Node Next;
public Node
One, reflection in Java
1. Load class properties and method instance code by reflection:
/** * Java.lang.Class is the source of reflection * We created a class that generates the corresponding class file by compiling (Javac.exe), after which
(i) Single-threaded recursive method
Copy Code code as follows:
Package com.taobao.test;
Import Java.io.File;
public class Totalfilesizesequential {
public static String FileName = "C:\\Documents and settings\\administrator\\
The code to send the message was copied directly from a previous application. Previously used Tencent's mail service, the program was executed without any problems. Later modified to Microsoft office365 Mail Service, but encountered two problems.
Public/protected/private
Public means open, private for privacy, protected for protection, nothing written for default defaults.
Method:
Public protected Default Private
√√√√ in the same class
√√√x in the same package
In the √√xx subclass
There are three kinds of shift operators in Java
>>: Right shift operator, NUM >> 1, equivalent to num divided by 2
>>>: Unsigned right shift, ignoring symbol bit, vacancy is 0
Let's take a look at how these shift operations are used
1. Calculate the maximum number of days in a January
Copy Code code as follows:
Calendar time=calendar.getinstance ();
Time.clear ();
Time.set (calendar.year,year); Year is int
Time.set (calendar.month,i-1); Note that the
1. Preface
Log4j is a reliable, fast, and flexible log Framework (API) written in Java that is published under the license of Apache software. LOG4J has been ported to languages such as C,c++,c#,perl,python and Ruby.
Log4j are highly configurable
1, verify that the incoming path is the correct path name (Windows system, other systems are not used)
Java code
Copy Code code as follows:
A regular expression that verifies whether a string is the correct path name
private static
Suppose there is a sequence: 2,1,3,5, the longest ascending sequence is 2,3,5 or 1,3,5, and the length is 3.
The idea of the LIS algorithm is:
Set existence sequence A.
① If there is only one element, then the length of the longest ascending
The Java code is as follows:
Copy Code code as follows:
Package Com.gjob.common;
public class URLtoUTF8 {
Convert to%e4%bd%a0 form
public static string toutf8string (string s) {
StringBuffer sb = new StringBuffer ();
for (int i = 0;
Mode one:
Double F = 3.1516;BigDecimal B = new BigDecimal (f);Double f1 = B.setscale (2, bigdecimal.round_half_up). Doublevalue ();
Mode two:
New Java.text.DecimalFormat ("#.00"). Format (3.1415926);#.00 represents a two-bit decimal #.0000
Have a chat with everyone. Java proxy mode
1. Static Agent
1.1 The proxy class of the static proxy and the class being represented should maintain a common interface.
Public interface Iuserdao {
void Save ();
1.2 Proxy classes,
This article for everyone to share is the commonly used date comparison method, for future reference.
Warm-up: get current time
SimpleDateFormat df = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");//Set Date formatString nowdate = Df.format (new
ClassLoader provides two methods for obtaining resources from the loaded classpath:
Public URL getresource (String name);
Here name is the classpath of the resource, which is relative to the location under the "/" root path.
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