Java Knowledge Point Finishing

Source: Internet
Author: User


One, the difference between HTTP and TCP/IP?
HTTP is an application-layer protocol that primarily addresses how data is encapsulated.
TCP/IP is a Transport layer protocol that mainly addresses how data is passed through the network.
The Web application uses the HTTP protocol as the application-layer protocol to encapsulate the HTTP text protocol, and then uses TCP/IP as the Transport Layer protocol to publish the information to the network.



Second, the parsing method of XML?
Basic parsing methods (DOM, SAX), DTD, XSLT
Sax is based on the parsing of event flow, Dom is based on the parsing of XML document tree structure

What are the pros and cons of Dom parsing?
Rationale: The parser reads the entire document, builds a tree structure that resides in memory, and then it can be used.
Advantages: The entire tree structure exists in memory convenient operation, support delete, modify, rearrange functions;
Cons: The entire document is stored in memory, wasting space and time.
Usage: Once the document has been parsed, the data will need to be used more than once, and the hardware resources are sufficient (memory, CPU).

What are the pros and cons of Sax generating and parsing XML?
To solve the problem with the DOM.
Advantage: No need to transfer the entire document in advance, less resources; code less than Dom parser, for applets, download!
Disadvantage: not persistent; After the event, if the data is not saved, the data will be lost, stateless; only text can be obtained from the event, but not the source;
Application: Applet; just know the small amount of XML content, seldom go back to visit, less machine memory.


When do strings and StringBuffer and StringBuilder all work?
String is generally used for fixed-length strings.
Use StringBuffer and StringBuilder for frequently modified or appended strings. (more efficient than string)
Multithreading with StringBuffer, thread-safe
Single threaded StringBuilder, thread non-secure. (fastest)

Summarize
1. If you want to manipulate a small amount of data with = String
2. Manipulating large amounts of data under a single-threaded operation string buffer = StringBuilder
3. Multi-threaded operation string buffer operation large amount of data = StringBuffer

Iv. What are the differences between threads and processes?
A thread is an execution unit within a process and a scheduler within a process.
Different from process:
1. Address space: An execution unit within a process; The process has at least one thread; they share the address space of the process, and the process has its own memory address.
2. Resource ownership: A process is a resource allocation and owned unit that shares the resources of a process with a thread within the same process.
3. Threads are the basic unit of processor scheduling, but the process is not.
4. Both can be executed concurrently.

V. for (foo (' A '); foo (' B ') && (i<2); foo (' C ')) The structure of the For loop?
1. Initialize statements
2. Loop termination Control
3. Execute each time the loop is completed

What is the difference between this and super?
This usually refers to the current object, and Super refers to the parent class;
Another use of this is to invoke another constructor of the current object, and super refers to something in the parent class.

Seven, the difference between public,private,protected?
Public modifier, which indicates that the member is open and accessible to all other classes;
Private modifier, which means that the member is private and can only be accessed by itself;
Protected modifier, that is, subclasses can access the protected members of the parent class, while other classes within the same package can also access the protected members.

Viii. What is polymorphism?
Polymorphic definition: means that objects of different classes are allowed to respond to the same message. That is, the same message can be used in a variety of different ways depending on the sending object.

Java Knowledge Point Finishing

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.