Java BASICS (101-122)

Source: Internet
Author: User
Tags informix sybase

101 Java will exist

Are there any leaks? Please briefly describe them.
There is indeed a Java memory leak, and the situation can become quite serious.

Java Garbage Collector Automatically releases objects that are not needed by programs in the memory to avoid

Memory leakage in most other program contexts. However, Java applications still have a considerable amount of memory leakage.

It is very difficult to find the cause.
There are two main java memory leaks:
* Object references that are no longer needed
* Unreleased system resources
2.2 Non-essential object reference
Java code often retains references to objects that are no longer needed, and this organizes the Garbage Collector's

Work. Java objects are usually referenced by other objects. Therefore, a single object can keep the entire object

The tree is in the memory, causing the following problems:
* After adding objects to the array, the processing for them is omitted.
* Reference is not released until you use the object again. For example, a menu command can plug in a pair

Such as instance reference and not released for later use, but may never happen.
* When other references still require the old state, you can rashly modify the object state. For example

The text file stores some attributes and uses an array, such as the number of characters and other fields are no longer needed

In the memory.
* Allows an object referenced by a long-running thread. Setting the reference to null does not help.

Objects will not be collected and released before exiting or idle
2.3 unreleased system resources
The Java method can be used to locate unexpected heap memory of a Java instance, such as memory resources for Windows and bitmaps.

Java often uses JNI (Java Native Interface) to call C/C ++ subprograms to locate these resources.

102. What is the mechanism for implementing polymorphism in Java?
Overriding and overloading are different manifestations of Java polymorphism. Rewrite

Overriding is a manifestation of the polymorphism between the parent class and the subclass.

A manifestation of polymorphism.

103. What is the basic principle of the garbage collector? Can the Garbage Collector recycle memory immediately? What is

How can I proactively notify virtual machines to recycle garbage?
For GC, when a programmer creates an object, GC starts to monitor the address, size, and

Usage. Generally, GC records and manages all objects in heap by Directed Graphs. Connect

In this way, determine which objects are "reachable" and which objects are "inaccessible ". When GC determines some

GC has the responsibility to recycle the memory space when it is "inaccessible. Yes. Programmers can execute manually

System. GC (), notifies the GC to run, but the Java language specification does not guarantee that GC will be executed.

104 what are the differences between static variables and instance variables?
Static I = 10; // constant
Class A; A. I = 10; // variable

105. What is Java serialization and how to implement Java serialization?
Serialization is a mechanism used to process object streams. The so-called object stream is to stream object content.

. You can perform read and write operations on Streaming objects, or transfer streaming objects between networks.

Serialization aims to solve the problems caused by read/write operations on Object streams.
Implementation of sequential partitioning: implement the serializable interface for the classes to be serialized. This interface does not need

Implementation Method, implements serializable is only to mark that the object can be serialized,

Then, an output stream (such as fileoutputstream) is used to construct an objectoutputstream (

Object stream) object, and then use the writeobject (Object OBJ) of the objectoutputstream object)

Method, you can write the object whose parameter is OBJ (that is, save its status). To restore the object, use the input stream.

106 can a non-static method be called from inside a static method?
No. If it contains the method () of the object, object initialization is not guaranteed.

107 When writing the clone () method, there is usually a line of code. What is it?
Clone has a default action. Super. Clone () is responsible for generating the correct size of space and copying data by bit.

108. in Java, how does one jump out of the current multi-nested loop?
Use the break; Return method.

109. What are the features of the interfaces list, map, and set when accessing elements?
A list holds elements in a specific order, and can contain duplicate elements. Set cannot have duplicate elements, internal sorting

. Map stores the key-value, which can be multiple values.

110. What is J2EE?
J2EE is a multi-layer (Multi-diered), distributed (distributed), based on Components

(Component-base) enterprise application model (enterpriese application model ).

In an application system, different components can be divided by function.

Machine, and in the corresponding level (Tier. The hierarchy includes the Client layer (clietn tier) component.

, Web layer and component, business layer and component, and Enterprise Information System (EIS) layer.

111 UML
Standard Modeling Language (UML. Use case diagram, static diagram (including class diagram, object diagram, and package diagram), behavior diagram, and interaction diagram (

Sequence diagram, cooperation diagram), implementation diagram.

112. You can name five common classes, packages, and interfaces.
Common classes: bufferedreader bufferedwriter filereader filewirter string

Integer
Common packages: Java. Lang java. AWT java. Io java. util java. SQL
Common interfaces: Remote list map document nodelist

113 what design patterns are used in development? In what scenarios?
Each mode describes a problem that is constantly emerging in our environment, and then describes the solution to the problem.

The core of the solution. In this way, you can use existing solutions countless times

Repeat the same job. The MVC design mode is mainly used. Used to develop JSP/servlet or J2EE

. Simple factory mode.

114. What actions does JSP have? What are their roles?
JSP has the following 6 basic actions: include: Introduce a file when the page is requested.

JSP: usebean: Find or instantiate a JavaBean. JSP: setproperty: Set

Attributes of JavaBean. JSP: getproperty: outputs the attributes of a JavaBean. JSP: Forward

: Transfer the request to a new page. JSP: Plugin: generated for the Java Plug-in based on the browser type

Object or embed tag.

115. Does anonymous inner class (anonymous internal class) support extends (inherited) other classes,

Can implements (implemented) interface (Interface) be implemented )?
It can inherit other classes or complete other interfaces. This method is often used in swing programming.

116 what is the difference between an application server and a web server?
Application Servers: Weblogic, tomcat, and JBoss
Web server: IIS, Apache

117. Relationship and difference between Bs and CS.
C/s is the abbreviation of Client/Server. Servers generally use high-performance PCs, workstations, or minicomputers, and

Large database systems such as Oracle, Sybase, Informix, and SQL Server are used. Client Needs

Install dedicated client software.
B/S is the abbreviation of Brower/server. Only one browser is installed on the client, as shown in figure

Netscape Navigator or Internet Explorer, the server installs Oracle, Sybase,

Informix, SQL Server, and other databases. In this structure, the user interface is completely through the WWW browser

Some transaction logic is implemented at the front end, but the main transaction logic is implemented at the server end. Browser

Use Web server to interact with databases.
Differences between C/S and B/S:
1. Different hardware environments:
C/s is generally built on a dedicated network. In a small network environment

The Portal Server provides connection and data exchange services.
B/S is built on a wide area network. It does not need to be a dedicated network hardware environment.

Use devices to manage information by yourself. It has a stronger adaptability than C/S. Generally, as long as there is an operating system and browsing

Just click
2. Different security requirements
C/s is generally oriented to relatively fixed user groups, and has strong information security control capabilities.

The encrypted information system adopts a C/S structure. Some public information can be published through B/S.
B/S is built on a wide area network, and its security control capabilities are relatively weak. It may be intended for unknown users.

.
3. Different program Architectures
The C/S program can pay more attention to the process, and can perform multi-level permission verification to ensure the system running speed.

Less consideration.
B/S's multiple considerations for security and access speed are based on the need for more optimization.

Higher requirements for B/S architecture than c/s is a development trend, from the. NET series of MS

Biztalk 2000 Exchange 2000 and so on, fully supporting systems built by network components. Sun and IBM

The JavaBean Component Technology is pushed to make B/S more mature.
4. Different Software Reuse
The reusability of components is not as good as that of B/S.

Good reusability.
The multiple structures of B/S pairs require relatively independent components and can be reused relatively well.

A dining table can be reused instead of a stone table on the wall.
5. Different system maintenance
Due to the integrity of the C/S program, it is necessary to conduct an overall investigation to solve the problems and upgrade the system.

Difficult. It may be another brand new system.
B/S components, which are replaced individually to achieve seamless system upgrade and reduce system maintenance overhead

To the minimum, users can download and install the SDK online.
6. Different handling problems
The c/s program can fix the user surface and meet high security requirements in the same region.

System related. It should be the same system.
B/S is built on the Wide Area Network. It targets different user groups and is scattered across regions, which cannot be implemented by C/S.

The relationship with the operating system platform is minimal.
7. Different user interfaces
C/s is mostly built on Windows platforms, with limited performance methods and high requirements on programmers.
B/S is built on a browser, with richer and more vivid expressions to communicate with users.

Reduced difficulty and reduced development costs.
8. Different information flows
C/S programs are generally typical centralized mechanical processing, with relatively low interaction.
B/S information flow to changeable, B-B B-C B-G and other information, flow changes, more like the transaction center.

118. Linux thread and GDI class explanation.
Linux implements the "one-to-one" thread model based on the core Lightweight Process.

A core Lightweight Process, and management between threads is implemented in the function library.
The GDI class is the image device programming interface class library.

119 struts applications (such as Struts Architecture)
Struts adopts the Java Servlet/JavaServer Pages technology to open web applications.

Source code framework. Use struts to develop a Model-View-Controller Design

Application architecture. Struts has the following main functions: 1. Including a controller

Servlet, which can send user requests to corresponding action objects. Ii. jsp free tag library, and

Provide Association support in controller servlet to help developers create interactive form applications. III.

Provides a series of practical objects: XML processing, automatic processing through Java reflection APIs

JavaBeans attributes, International prompts, and messages.

120. What is JDO?
JDO is a new specification for Java object persistence. It is short for Java data object and is also used

Standard API for accessing objects in a data warehouse. JDO provides transparent object storage, so

For developers, the stored data objects do not need code out of the quota (such as the use of JDBC APIs ). This

Some tedious routine work has been transferred to the JDO product provider to free developers.

Focus on the business logic. In addition, JDO is flexible because it can be used at any data underlying layer.

. JDBC is more common for Relational Database Service (RDBMS) JDO and is provided to any underlying data

Storage functions, such as relational databases, files, XML, and object databases (odbms ),

Applications are more portable.

121 can an internal class reference its members in the class? Are there any restrictions?
An internal class object can access the content of its external Class Object

If the internal class is not static, it can access all attributes of the external class object that creates it.
If the internal class is sattic, that is, nested class, it can only access the external class that creates it.

All static attributes of an object

In general, only public or package access is modified for common classes, while internal classes can achieve static,

Such as protected and private.

When inherited from external classes, internal classes are not covered, they are completely independent entities, each

All of them are in their own namespace. If they are explicitly inherited from the internal class, they can overwrite

Method.

122. Web Service terminology. Jswdl Development Kit introduction. JAXP and jaxm. Soap,

UDDI and WSDL interpretation.
Web serviceweb service is a network-based, distributed modular component that executes a specific

And comply with specific technical specifications. These specifications enable the Web service to work with other compatible components.

Interoperability.
JAXP (Java API for XML parsing) defines the general usage of Dom, sax, and XSLT in Java.

. In this way, you only need to use these universal interfaces in your program. When you need to change the actual

You do not need to modify the code.
Jaxm (Java API for XML messaging) provides access methods and transmission mechanisms for soap communication.

API.
WSDL is an XML format used to describe network services as a group of endpoints.

Document Information or process-oriented messages. This format first abstracts operations and messages

And then bind it to a specific network protocol and Message format to define the endpoint. Specific End

Points are combined into abstract endpoints (services ).
Soap is the Simple Object Access Protocol, which is used to exchange XML

A lightweight protocol for encoding information.
The purpose of UDDI is to establish standards for e-commerce. UDDI is a set of web-based, distributed, and

The implementation standards and specifications of the Information Registration Center provided by the Service also include a group

Provides Web Service Registration to enable other enterprises to discover the implementation standards of access protocols.

Soap is the most critical technology for Web Services and the media for data and method transfer in Web Services.

Web Service Definition Language (WSDL) describes the interfaces and functions of Web Services.
 

 




 

 

 

 

 

 

 

 

 

Related Article

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.