Java Related Basics (6)

Source: Internet
Author: User
Tags anonymous garbage collection implement informix sybase variable thread access
101, there will be memory leaks in Java, please describe briefly.
Yes. such as: int i,i2; return (I-I2); When I is a positive enough number, i2 is a large enough negative number. The result is an overflow, resulting in an error.
102, Java in the implementation of polymorphic mechanism is what?
The overridden overriding and overloaded overloading of methods are different manifestations of Java polymorphism. Overriding overriding is a manifestation of polymorphism between parent classes and subclasses, and overload overloading is an expression of polymorphism in a class.
103. What is the basic principle of the garbage collector? Can the garbage collector reclaim memory immediately? What are the ways to actively notify virtual machines for garbage collection?
For GC, when a programmer creates an object, the GC begins to monitor the address, size, and usage of the object. Generally, the GC uses a heap to record and manage all the objects in the heap (). In this way, determine which objects are "accessible" and which objects are "unreachable." When the GC determines that some objects are "unreachable," the GC is responsible for reclaiming the memory space. OK. The programmer can manually execute System.GC () to notify the GC to run, but the Java language specification does not guarantee that the GC will execute.
104. What is the difference between a static variable and an instance variable?
static i = 10; Constant
Class A A; A.I =10;//Variable
105, what is Java serialization, how to implement Java serialization?
Serialization is a mechanism used to process object flow, which means that the object flow is the streaming of the object's contents. The objects that can be streamed are read and write, and the streaming objects can be transferred between the networks. Serialization is a solution to problems that arise when reading and writing to an object stream.
Serialization implementation: The Serializable interface that will need to be serialized implements the interface, which has no method to implement, implements serializable just to annotate that the object is serializable, and then use an output stream ( such as: FileOutputStream) to construct a ObjectOutputStream (object stream) object, and then use the writeobject of the ObjectOutputStream object. Object obj Method can write out (that is, save its state) an object whose parameter is obj, and then use the input stream to recover.
106. Can you emit a call to a non-static method from within a static method?
No, if it contains the object's method (), the object initialization cannot be guaranteed.
107, write the Clone () method, usually has a line of code, what is?
Clone has the default behavior, Super.clone (); He is responsible for generating the correct size of space and copying it bits by bit.
108, in Java, how to jump out of the current multiple nested loops?
With a break; Return method.
109, List, MAP, set three interfaces, access elements, what are the characteristics of each?
The List holds elements in a particular order and can have duplicate elements. Set cannot have duplicate elements, internal sort. Map holds Key-value value, value can be multi-valued.
110, what is the Java EE?
Java EE is a multi-layer (multi-diered), distributed (distributed), component-based (component-base) Enterprise Application Model (Enterpriese application models) presented by Sun. In such an application system, functions can be divided into different components, which can be on different computers and at the appropriate level (tier). The hierarchy includes the customer layer (CLIETN tier) component, Web tier and component, business layer and component, Enterprise Information System (EIS) layer.
111, the UML aspect
Standard modeling Language UML. Use case diagram, static diagram (including class diagram, object graph and package diagram), behavior graph, interaction diagram (sequence diagram, cooperation diagram), implementation diagram.
112, say some commonly used classes, packages, interfaces, please lift 5
Common classes: BufferedReader bufferedwriter filereader filewirter String Integer
Commonly used packages: Java.lang java.awt java.io java.util java.sql
Common interfaces: Remote List Map Document nodelist
113, the development of the use of those design patterns? What's the occasion?
Each pattern describes a problem that continues to occur in our environment, and then describes the core of the solution to the problem. In this way, you can use the existing solutions countless times without having to repeat the same work. The main use of the MVC design pattern. Used to develop Jsp/servlet or Java-EE related applications. Simple factory model and so on.
114. What is the action of JSP?
JSP has a total of the following 6 basic actions jsp:include: When the page is requested to introduce a file. Jsp:usebean: Find or instantiate a JavaBean. Jsp:setproperty: Sets the properties of the JavaBean. Jsp:getproperty: Outputs a JavaBean attribute. Jsp:forward: Move the request to a new page. Jsp:plugin: Generates an object or embed tag for the Java plug-in based on the browser type.
115. Anonymous Inner Class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)?
You can inherit other classes or complete other interfaces, which is common in swing programming.
116. What is the difference between an application server and a Web server?
Application server: Weblogic, Tomcat, Jboss
WEB Server:iis, Apache
117, BS and CS and the difference between.
C/S is the abbreviation of Client/server. Servers typically use High-performance PCs, workstations, or minicomputer, and use large database systems, such as Oracle, Sybase, Informix, or SQL Server. Clients need to install dedicated client software.
b/S is the abbreviation for Brower/server, as long as the client installs a browser (Browser), such as Netscape Navigator or Internet Explorer, the server installs Oracle, Sybase, Informix, or Databases such as SQL Server. Under this structure, the user interface is implemented completely through the WWW browser, some of the transaction logic is implemented in the front-end, but the main transaction logic is implemented on the server side. The browser interacts with the database through Web Server.
c/S and b/s difference:
1. Different hardware environments:
c/S is generally based on a dedicated network, a small area of the network environment, the LAN through specialized servers to provide connectivity and data exchange services.
b/S is based on the WAN, do not need to be a dedicated network hardware environment, example and telephone Internet, rental equipment. Information is managed by itself. There are more than C/s adaptable range, generally as long as the operating system and browser on the line
2. Different security requirements
c/S is generally oriented to a relatively fixed user base, the ability to control information security is very strong. The general highly confidential information system uses C/s structure suitable. Can be published by B/S part of the public information.
b/S is built on the wide area network, the ability to control the security is relatively weak, it may be to unknown users.
3. Different to program architecture
c/S program can pay more attention to the process, the authority can be multi-level calibration, the system can be less speed of operation.
b/S multiple consideration of security and access speed is based on the need for more optimization. higher than c/s requirements The program architecture of B/s structure is the trend of development, from the MS of the. NET series of BizTalk Exchange 2000, and so on, fully support the network components built system. SUN and IBM push the JavaBean component technology, etc., make B/s more mature.
4. Software reuse is different
The C/S program can be considered as a whole, and the reuse of component is inferior to the reuse of the component under B/S requirement.
The multiple structure of B/s pairs requires the relative independent function of the component. Can be used relatively well. The table that you buy can be reused, not the stone table on the wall.
5. system maintenance is different
Because of the integrity of the C/s program, it is necessary to inspect it, deal with the problems and upgrade the system. Upgrade is difficult. It could be a whole new system.
b/S components, aspects of the replacement of individual components to achieve seamless upgrade of the system. The system maintenance overhead is minimized. Users can download and install themselves from the Internet to achieve upgrades.
6. Handle problems differently
c/S program can handle the user face fixed, and in the same area, security requirements high demand, and operating system-related. It should all be the same system.
b/S is based on the WAN, for different user groups, dispersed regions, this is C/s can not be done. Minimal relationship with operating system platform.
7. User interface is different
More than C/s is built on the window platform, the performance method is limited, the programmer generally requires higher
b/S is based on the browser, there is a richer and more vivid way to communicate with users. And most of the difficulty is reduced and the development cost is reduced.
8. Information flow is different
c/S program is typically a typical centralized mechanical processing, relatively low interaction
b/S information flow can change, b-b b-c b-g and other information, flow changes, more like trading center.
118, Linux thread, the interpretation of the GDI class.
Linux implements a "one-to-one" threading model based on core lightweight processes, one thread entity corresponding to a core lightweight process, and the management between threads implemented in an external function library.
The GDI class is an image device programming interface Class Library.
119, struts application (such as Struts framework)
Struts is an open source framework that uses the Java Servlet/javaserver Pages technology to develop Web applications. Struts can be used to develop an application framework based on MVC (Model-view-controller) design pattern. Struts is the main function of the following: A. Contains a controller servlet that sends a user's request to the appropriate action object. Two. JSP free tag Library, and provides associated support in the controller servlet to help developers create interactive form applications. Three. Provides a series of practical objects: XML processing, automatic processing of JavaBeans attributes via Java Reflection APIs, internationalization hints and messages.
120. What is JDO?
JDO is a new specification for Java Object Persistence, abbreviated for Java data Object, and a standardized API for accessing objects in a data warehouse. JDO provides transparent object storage, so for developers, storing data objects does not require additional code (such as the use of the JDBC API). These tedious routines have shifted to the JDO product provider, freeing the developer to focus time and effort on the business logic. In addition, JDO is flexible because it can run on any underlying data. JDBC is more generic to relational database (RDBMS) JDO, providing storage functionality at the bottom of any data, such as relational databases, files, XML, and Object Databases (Odbms), and so on, making applications more portable.



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.