import java.io.*;import java.util.*;public class Logon implements Serializable { /** * */ private static final long serialVersionUID = 1L; private Date date = new Date(); private String username; private transient String
During the interview, the interviewer always asked questions about the design model. Although we will inadvertently use the design model when writing the program, we still cannot tell in front of the interview manager, here I have recorded some of
The template method mode defines the skeleton of an algorithm in an operation and delays some steps to the subclass. The template method allows the subclass to redefine certain steps of an algorithm without changing the structure of an
The Code is as follows:
Public static String getHost (String url) {Pattern p = Pattern. compile ("(http: // | https ://)? ([^/] *) ", Pattern. CASE_INSENSITIVE); Matcher m = p. matcher (url); return m. find ()? M. group (2): url ;}
Test code
(1) Compile the Servlet and compile it into a class file. during compilation, add the servlet-api.jar file (under the/common/lib directory) to the classpath;
② Copy the compiled class file to the application's WEB-INF/classes/(such
In the same test, compared with Spring TestContext, JUnit has the following advantages:
1. Spring TestContext can be used to manually set test transaction rollback,No data destruction
2. You do not need to manually assemble beans in the test class.
Subclass Generation Process
See the Code:
Class Person {String name; int age; Person () {System. out. print ("no-argument constructor of Person");} Person (String name, int age) {this. name = name; this. age = age; System. out. print ("constructor
1. Declare a callback Interface:
Public interface CallBack {/*** execution CallBack Method * @ param objects return the processed result as a parameter to the CallBack Method */public void execute (Object... objects );}
2. The callback part
1 sendRedirect
Response. sendRedirect ();
The server sends a status code based on the logic, telling the browser to request a new address. Generally, the browser will use all the parameters in the previous request to request a new address.
Digital triangle
Description:There is a triangle composed of non-negative integers. There is only one number in the first row, and there is no number in the lower left and lower right except for the downlink.Problem:Starting from the number in the
Problem:
There are N items and a backpack with a capacity of V. A maximum of n [I] items are available for the I-th item. The cost per item is c [I] and the value is w [I]. Solving which items are loaded into a backpack can make the total cost of
I,
1. What is object-oriented?
Object-oriented is a programming method; Object-oriented is a way of thinking; not a programming language.
2. How should we learn object-oriented?
Understand the syntax of an object-oriented language;
Master the object-
The factory method mode defines an interface used to create objects so that the subclass decides which class to instantiate. The factory method delays the instantiation of a class to its subclass.
Role:
1. Abstract Factory (Creator) role:
Is the
Synchronizing a method may reduce the execution efficiency by 100 times.
The control of static Initialization is in Java.
One class and one responsibility principle. (classes should do one thing and only do one thing) but one piece does two things.
Servlet listeners are divided into three typesI listen to creation and destruction of ServletContext, Request, and Session scopes(1) ServletContextListener(2) HttpSessionListener(3) ServletRequestListenerII listen to attributes changes in the
/*** I thought there was no problem with the simple code below in a large project, but it took me some time to figure out the BUG, this Code simply adds two strings. Let's take a look at the output content. **/@ Testpublic void test () {StringBuffer
Author: X Wang
Source: http://www.programcreek.com/2013/09/top-10-methods-for-java-arrays/
Repost the article. repost the article with the author and source.
The following are top 10 methods for Java Array. They are the most voted questions from
A basic concept: this class is a subclass of the initramsocket mentioned above.
Mongoramsocket only allows data to be sent to the specified destination address, while MulticastSocket can send data reports to multiple clients in broadcast mode.
To
What are the advantages of spring?1. Reduced coupling between components and realized decoupling between layers of software2. You can use many services that are easy to provide, such as transaction management and message service.3. Container
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