For the list,
Train of Thought Analysis: to traverse a list in reverse order, first obtain a ListIterator, use the for () hasNext () method as the judgment condition, and execute next () cyclically () the method locates the cursor at the end of the
First, let's get to know several classes.
Class (java. lang. Class)
Obtain the ClassgetClass () method.
For example, run this line of code:
System. out. println ("test". getClass (). toString ());
The result is:
Class java. lang. String
Field
The novel I just got started with in the morning, I tried to pull it from my website and make it an e-book in the afternoon ~ Just do it ~
[Packet capture]
This step is more important than anything. If you cannot find the request to obtain the real
Due to project requirements, I picked up the previously used webservice again, and this time I chose Java Native Jaxws without a jar package. First, use wsimport. First, share my usage: Go to the project path under cmd, and then run the following
2013/13/3In traditional java applications, the bean life cycle is very simple. The keyword new initializes the bean, and then the producer is used. Once the bean is no longer used, it enters the garbage collection stage to process the spring bean
As the beginning. It is necessary to explain. Writing an article is not forced by me. It is just a record. First of all, let's define the policy mode! Policy mode: defines algorithm clusters and encapsulates them separately. They can be exchanged.
1. Select sorting
Thought: select the smallest (or largest) element from the data elements to be sorted for each trip, and place the order first (or last) of the sorted series ), until all data elements to be sorted are sorted. Analysis example:
In the Struts2 framework, you need to use execute in the response class to return strings in a way that corresponds to the name of the result component registered in the struts. xml file.
Returned string in execute:1. the value in the returned
1. The index in list. get (index) is a negative value. An exception occurred.
Severe: Exception occurred during processing request:-1
Java. lang. ArrayIndexOutOfBoundsException:-1
Cause: if (null! = List. get (list. size ()-1) & null! = List.
Use ajax to obtain the date value on the response header. Note the time zone. In the chrome development tool header, all values are Greenwich Mean Time, which is 8 hours less than Beijing time, the obtained time zone is related to the server
Prototype: Use a prototype instance to specify the object type and copy the prototype to create a new object.
The class diagram is as follows:
We all know that the following code cannot create new objects. They all point to the same object.
Case
Builder mode: separates the construction of a complex object from its representation, so that different representations can be created during the same build process. That is, assembling a complete product requires different parts, and different
In java, you can refer to the following code to generate json or use it in a loop to generate a json array.Sb. append ("{\" openId \":\"");Sb. append (openId );Sb. append ("\", \ "content \":\"");Sb. append (content );Sb. append ("\", \ "headimgurl \
Question prototype:
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,Given n =3,You shoshould return the following matrix:
[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]Basic Ideas:
We noticed
If you want to count the amount of code (number of lines) of the project, it is very troublesome to count every file of the entire project. In addition, if you want to find or replace a word in a project and find a file one by one, it is also a
1. Why reflection:If an external Object is received when the program runs, the compilation type of the Object is Object, but the program needs to call the method of the Object running type:(1). If the compilation and running types are all known, use
Jar command Java Archive File, java Archive File. This is similar to a zip file.
Usage: jar {ctxu} [vfm0Mi] [jar-file] [manifest-file] [-C Directory] File Name...
Option:
-C. Create a new archive
-T list the archived content
-X expand the named (or
Conclusion: static attributes and static methods in java can be inherited, but not overwritten. cause: 1 ). static methods and attributes belong to the class and are called directly by the class name. the method name is correct and does not require
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