Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the five interview questions of Java?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the five interview questions of Java". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the five interview questions of Java"?

What is the role of XML technology?

XML technology is used for data storage,

Information configuration,

Three aspects of data exchange.

Data can be stored in XML

Through nodes,

Element content,

Property to indicate the content and relationship of the data.

You can use XML to configure information conveniently.

Various configuration parameters and object relationships of software

Are stored in XML files.

When working as a data exchange platform

Assemble the data into a XML file

Then compress and package the XML file and encrypt it

Send it to the recipient over the network

Receive, decrypt and decompress, and then in the same XML file

Restore the relevant information for processing.

What are the XML document constraints? What's the difference?

There are two forms of definition

Dtd document type definition and SchemaXML schema

Both XML Schema and DTD are used for document validation

But there are still some differences between the two.

The essential difference is that Scheme itself is xml.

Can be parsed by XML parser

This is also the fundamental purpose of developing Schema from DTD.

In addition,

XML Schema is a content open model

Scalable and functional

The scalability of DTD is poor.

XML Schema supports a wide range of data types

DTD does not support the data types of elements.

The type definition of attributes is also limited.

XML Schema supports namespace mechanism

DTD does not support it.

XML Schema can be tailored to different situations

Validate the entire XML document or part of the document

DTD lacks this flexibility.

XML Schema fully complies with the XML specification

Conforms to XML syntax

Can be used in conjunction with DOM

Powerful function

DTD grammar itself has its own grammar and requirements.

It's hard to learn.

What are the parsing methods of XML? What's the difference?

1.DOM parsing:

The full name of DOM is Document Object Model

The document object model.

In the application

XML Analyzer based on DOM

Convert an XML document to

A collection of object models (often called DOM trees)

The application is precisely through the

The operation of this object model

To realize the operation of XML document data.

Through the DOM interface

The application can be used at any time

Access any part of the data in the XML document

Therefore, this mechanism that utilizes the DOM interface

Also known as random access mechanism.

2.SAX parsing:

The full name of SAX is Simple APIs for XML

That is, XML simple application program interface.

Different from DOM

The access mode provided by SAX is a sequential mode.

This is a way to quickly read and write XML data.

When using a SAX parser to parse an XML document

Will trigger a series of events.

And activate the corresponding event handling function

The application uses these event handler functions

Achieve access to XML documents

Therefore, the SAX interface is also called event-driven interface.

3.JDOM parsing:

JDOM uses the Collection architecture in Java to encapsulate collections

It is a model that Java lovers are more familiar with.

4.DOM4J parsing:

The xml parser loads the entire xml document into memory at once.

Then build an object tree of Document in memory

Through the Document object

Get the node object on the tree

Access (manipulate) the contents of an xml document through a node object

What is the difference between Get and Post requested by Http?

1. Get submits the request in clear text from the address bar

Information content

? username=admin&password=123

Visible to the user

While post submits the request information content from the request body

The user is not visible.

2. Get submission because it is passed from the address bar

The length of the address bar of the browser is limited.

Cannot submit big data

Post passes the information content from the request body

There is no limit to file size

Only post can be selected for file upload.

3. The request object is the server that acquires the request information.

Get from the request header and the request body

We can use the request.setCharacterEncoding method

Modify the character encoding information of the request object

However, the address bar character encoding cannot be modified.

Get passes information from the address bar

You cannot use the request.setCharacterEncoding method

To modify the character encoding.

Post submits the request body as an form form from the request body

So you can use request.setCharacterEncoding

This method modifies the character encoding.

4. Summary: you can use post submission as much as possible using post submission.

What is the difference between a ServletConfig object and a ServletContext object?

A Servlet pair should have a ServletConfig object

Can be used to read initialization parameters.

A webapp corresponds to a ServletContext object.

ServletContext object

Gets the parameters defined by initialization.

The ServletContext object can be accessed through the

Context.getResourceAsStream ("/ PATH")

Or context.getRealPath ("/").

To get the resource file for webapp.

Of the ServletContext object

SetAttribute (String name,Object o) method

You can store objects in the Context scope

Also known as global scope

It can be shared throughout the web application.

ServletContext object

Can communicate with the server

For example, write information to the log information of the server.

At this point, I believe you have a deeper understanding of "what are the five interview questions of Java". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report