Note:
There may be differences in the expansion mechanism for different JDK versionsExperimental environment: JDK1.8
expansion mechanism :
When adding elements to the ArrayList, ArrayList will increase its storage capacity and meet the requirements
Today, when writing the constructor method, there is a small problem, caused by this problem a series of thinking, in a Java class in the initialization of variables and classes what is the order of execution?# # problems
1. Abstract classIn object-oriented concepts, all objects are depicted by classes, but conversely, not all classes are used to depict objects, and if a class does not contain enough information to depict a specific object, such a class is an
The ToString () method in the collection object1. Code:public class Test {public static void Main (string[] args) {Collection c=new arraylist ();C.add ("Hello");C.add ("World");C.add ("Java");System.out.println (c);}}Output Result:[Hello, World,
java.lang.String; is a string type, the first thing to note about the string class is the following:1. Once the string is created, it cannot be changed. Once the "ABC" string object is created, it can no longer become "ABCD";2. Improve the access
File read/writeIf you write a large amount of data in your code, it will increase the redundancy of the Code, by reading the file, you can streamline the code, easy to modify the data and code maintenanceClassification of IO streams: byte stream and
The concept of polymorphism:In simple terms, a different state exists in the course of a thing, that is, a reference variable defined by a parent class or interface that points to a subclass or an instance object of a concrete implementation class.
Work for a long time, found that there is a very interesting phenomenon, from the programmer, senior programmers, to now hang architects, experts and other titles, along with the technology and ability to improve, do not understand more and more
Tool categorypublic class Ben2xmlutil {/*** Convert objects directly to XML output of type string** @param obj* @return*/public static String converttoxml (Object obj) {Create an output streamStringWriter SW = new StringWriter ();try {Using the
In 1.struts2, how does action get the data that the user has entered from the page, and how does it pass the data to the view layer?A: (1) There are three ways the action gets data from the page:
A linear table is a linear structure that can insert and delete elements at any location, consisting of n elements of the same type. Mainly include sequential table, single linked list, circular single linked list, bidirectional linked list and
Java EE Custom article building Java EE Environment1 6. 1 overview1 6. 1. 1 schematic:If you need to develop a J a V A e e under L i n u x, we need to install the following software1 6. 2 Mounting J D K1 6. 2.2 Installation Steps0) First upload the
Java deserialization-The Transformedmap class can execute malicious code in the principle of 0x00 codeMap map=new HashMap (); Map.put ("Key", "value"); Call the ToString method of the target object String command= "Calc.exe";
1. What is threadlocalThreadlocal is a thread-local variable as the name implies. This variable is different from the normal variable, which is accessed by the get and set methods in each thread, each with its own independent copy of the variable.
What is a static variableAs we all know, we can create multiple objects of this class based on a class, each with its own members and independent of each other.At some point, however, we would prefer all objects of the class to share the same member.
Member DifferencesAbstract class:Member variables: Can be variables, or constantsConstruction method: AvailableMember methods: can be abstract or non-abstractInterface:Member variable: can only be a constantMember methods: can only be
First, identifierssecond, naming normsthird, the data type1. Classification by data type
· Defines specific data types for each type of data, allocating different sizes of memory space in memory
· The basic data Types in Java have fixed
I. LinkedList COMMON operationsPackage list related;/** * LinkedList link list * LinkedList: The underlying data structure used by the table. Features: Fast and easy to delete, query speed slightly slower; */import Java.util.iterator;import
Sometimes, there may be a need for something like this:For this effect, we can have a solution like this: Packagebys.utils;Importjava.io.UnsupportedEncodingException;/*** Created by Toutou on 2014/2/21*/ Public classChinesecharacterhelper {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