Java Advanced Stage Knowledge point Rollup

Source: Internet
Author: User
Tags closing tag xpath

First, Collection Framework and generics

    1. 1. definition

A collection frame is used to store a set of elements that are variable in length.

    1. 2. common interfaces and classes

Interfaces: Collection, List, Set, Map, Iterator

Classes: ArrayList, LinkedList, HashSet, HashMap

Both the list interface and the set interface inherit from the collection interface.

    1. 3. Usage features

List: The stored elements are not unique and orderly.

Set: The stored element is unique and unordered.

MAP: Elements are stored in the same way as key-value pairs.

    1. 4. The difference between ArrayList and linkedlist

ArrayList: Find elements fast, high performance, but not suitable for frequent insertion, modification, deletion of collection elements.

LinkedList: High efficiency and speed when inserting, modifying and deleting collection elements frequently, but not as fast as ArrayList.

    1. 5. Common Methods of collection:

List:

Add (Object obj), remove (object obj), remove (int index), size (), get (int index), iterator (), clear ()

Set:

Add (Object obj), remove (object obj), size (), iterator (), clear (), no get method

MAP:

Put (object key, Object value), get (Object key), KeySet (), values (), size (), remove (object key), clear ()

Second, Practical Class

    1. 6. Enumeration

Definition: A fixed set of constants.

Grammar

Access modifier enum enum name {

Constant One,

Constant Two,

... ...

}

Usage

Declare the enumeration variable and assign the value: Season Season = season.spring;

Switch

Switch (enumeration variable) {

Constant one:

... ...

break;

Constant two:

... ...

break;

}

    1. 7. Packing class

There is a corresponding wrapper class for each value type (base data type).

Int->integer, Double->double, Boolean->boolean, Char->charactor 、... ...

Mutual conversions of value types and wrapper classes

Unpacking and boxing

Boxing: Converts a value type to a reference type.

Unboxing: Converts a reference type to a value type.

    1. 8. Math class

The role of the math class

Provides a range of methodologies related to scientific calculations.

Common methods: Random (), floor (), ceiling (), Max (), Min (), round ()

    1. 9. String class

Common methods: substring (), indexOf (), lastIndexOf (), replace (), split (), Length ()

    1. Random class

Function: Generates a random number.

Common methods: Nextint (), nextint (int), nextdouble (), nextxxx ()

    1. One . Date Time class

Date

Calendar

SimpleDateFormat

    1. What is the difference between StringBuilder (StringBuffer) and String ?

When a String is in operation (such as assignment, stitching, and so on) a new instance is generated, and StringBuilder does not. So it's best to use StringBuilder (StringBuffer) When a large number of string concatenation or frequent manipulation of a string, and do not use string.

Third, Input/Output IO

IO operation-related packages: java.io

    1. File class

Functionality: Implements general operations on files and directories.

Common methods:

Method name

Role

Exits ()

Determine if a file or directory exists

    1. Classification of streams

Classification by direction:

Input: InputStream, Reader

Output: OutputStream, Writer

Classification of data units based on flow operations:

BYTE stream: InputStream, OutputStream

Character stream: Reader, Writer

Implementation class

(pump) inputstream

(pumping) OutputStream

(draw) Reader

Writer

FileInputStream

FileOutputStream

InputStreamReader

OutputStreamWriter

DataInputStream

DataOutputStream

FileReader

FileWriter

ObjectInputStream

ObjectOutputStream

BufferedReader

BufferedWriter

Serialization and deserialization

Serialization refers to the process of converting the state of an in-memory object into a format that can be stored or transmitted.

Four, Multithreading

    1. The differences between processes and threads

A running instance of an executable program in a computer is a process. A process can contain multiple threads. A single thread is used to complete a task, while creating multiple threads to accomplish multiple tasks is multithreaded.

Both define a boundary, but the process defines the boundary between the application and the application, and the code and data space cannot be shared between different processes, and the thread defines the boundaries of the code execution stack and execution context.

In a metaphor, if a family represents a process, within the family, each member is a thread, and each member of the family has an obligation to accumulate the wealth of the family, while also having the right to consume the household wealth, and when confronted with a task, the family can also send several members to cooperate to complete, People outside the family have no way of directly consuming property that does not belong to their own family.

    1. steps to using threads in Java
    1. 2 ways to define threads in Java
    2. Priority of Threads
    3. The life cycle of a thread
    4. synchronization of Threads
    5. . Thread Common methods

Five, Network Programming

    1. What is TCP and UDP, and what are their differences?

TCP (transmission Control Protocol, transmission Protocol) is a connection-based protocol, which means that a reliable connection (trust connection) must be established with the other party before the data is formally sent and received.

UDP (User data Protocol, Subscriber Datagram Protocol) is the protocol that corresponds to TCP. It is a non-connected protocol that does not establish a connection with the other, but sends the packet over directly!

UDP is suitable for applications that transmit small amounts of data at a time and are not highly reliable, but transmit at a fast speed.

TCP is suitable for transmitting a large amount of data at a time, high reliability requirements of the environment, data transmission speed is slow.

Six, XML Operation

    1. the basic concepts of XML

XML to extend markup language. Typically used to store data and transfer data between networks.

XML is much like Hypertext Markup Language (HTML), but it does not specify which tags are intrinsic.

The XML usage specifications broadly include:

The first behavior XML declaration for each XML file, which defines information such as the XML version and encoding.

An XML document has and has only one root node.

The XML is case-sensitive.

Each XML tag must contain a start tag and an end tag.

The XML tag must be properly absconded.

    1. The main differences between XML and HTML

XML is used to store and transfer data, while HTML is used to display data.

XML distinguishes between uppercase and lowercase letters, while HTML is not.

The opening tag of the HTML can have no closing tag, and the opening tag of the XML must correspond to the closing tag.

In XML, attribute values must be enclosed in quotation marks. In HTML, the quotation marks are available for use.

You can have a property name without a value in HTML. However, in XML, all attributes must have corresponding values.

tags in XML can be customized by the user, while HTML contracts which tags can be used.

    1. What are the techniques for manipulating XML in JAVA

Dom Mode

The DOM is the standard API for processing XML, and it is the basis for many other standards related to XML processing. It operates based on the relationships between nodes in the XML document, and the biggest problem is that the entire XML document needs to be loaded into memory at once.

Sax

SAX fundamentally solves the resource-intensive problems that DOM produces when parsing XML documents. It is implemented through a stream-like parsing technique that reads through the entire XML document tree and responds to the programmer's need for XML data parsing through an event handler.

dom4j

DOM4J is an easy-to-use, open-source library for Xml,xpath and XSLT. It is applied to the Java platform, implemented with the Java Collection framework, and fully supports Dom,sax and JAXP.

    1. What is XPath

An XPath is an XML Path Language (XML pathname Language), which is a language used to determine the location of a part of an XML document. XPath is an XML-based tree structure that provides the ability to find nodes in a data structure tree.

An expression

Description

Example

NodeName

Select all child nodes of this node

Bookstore ()

/

Select from the root node

/bookstore (select root element Bookstore)

//

Selects a node from the matching current node, regardless of location

Book selects all book child elements, regardless of their location

.

Select the current node

..

Select the parent node of the current node

@

Select Properties

@lang Select All properties named Lang

Java Advanced Stage Knowledge point Rollup

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.