JAVA basics-full explanation of Java BASICS (6)

Source: Internet
Author: User

101. Is there any memory leakage in java? Please briefly describe it.
Yes. For example: int I, i2; return (i-i2); // when I is a positive number large enough, i2 is a negative number large enough. The result may cause overflow and errors.


102. What is the mechanism for implementing polymorphism in java?
Overriding and Overloading are different manifestations of Java polymorphism. Overriding is a manifestation of the polymorphism between the parent class and the Child class, and Overloading is a manifestation of the polymorphism in a class.


103. What is the basic principle of the garbage collector? Can the Garbage Collector recycle memory immediately? Is there any way to proactively notify virtual machines to recycle garbage?
For GC, when a programmer creates an object, GC starts to monitor the address, size, and usage of the object. Generally, GC records and manages all objects in heap by Directed Graphs. This method is used to determine which objects are "reachable" and which objects are "inaccessible ". When GC determines that some objects are "inaccessible", GC has the responsibility to recycle the memory space. Yes. Programmers can manually execute System. gc () to notify 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; a. I = 10; // variable


105. What is java serialization and how to implement java serialization?
Serialization is a mechanism for processing object streams. Object streams are called object streams that 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.
Serialization implementation: implement the Serializable interface for the class to be serialized. There is no implementation method for this interface. 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. Then, the writeObject (Object obj) of the ObjectOutputStream Object is used) 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 repeated elements and can be sorted internally. Map stores the key-value, which can be multiple values.


110. What is J2EE?
J2EE is a multi-layer (multi-diered), distributed (distributed), component-based enterprise-level application model (enterpriese application model) proposed by Sun ). in such an application system, different components can be divided by function. These components can be located on different computers and at the corresponding level (tier. The hierarchy includes the Client layer (clietn tier) components, web layer and components, Business layer and components, 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) to implement the 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 core of the solution to the problem. In this way, you can use existing solutions countless times without repeating the same work. The MVC design mode is mainly used. Used to develop JSP/Servlet or J2EE applications. 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: Transfers requests to a new page. Jsp: plugin: generate the OBJECT or EMBED tag for the Java Plug-in based on the browser type.


115 can Anonymous Inner Class (Anonymous internal Class) be extends (inherited) other classes, or implements (implemented) interface (interface )?
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, or SQL Server. The client must install dedicated client software.
B/S is the abbreviation of Brower/Server. to install a Browser on a client, such as Netscape Navigator or Internet Explorer, the Server installs Oracle, Sybase, Informix, SQL Server, and other databases. In this structure, the user interface is fully implemented through the WWW browser. Some transaction logic is implemented at the front end, but the main transaction logic is implemented at the server end. The browser interacts with the database through the Web Server.
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 LAN provides connection and data exchange services through dedicated servers.
B/S is built on a wide area network. It does not need to be a dedicated network hardware environment, such as accessing the Internet over the phone and renting equipment. information management. it has a stronger adaptability than C/S. Generally, only the operating system and browser are available.
2. Different security requirements
C/S is generally oriented to relatively fixed user groups and has strong information security control capabilities. generally, the C/S structure is suitable for highly confidential information systems. some public information can be published through B/S.
B/S is built on a wide area network, which has relatively weak security control capabilities and may be intended for unknown users.
3. Different program Architectures
The C/S program can focus more on processes, perform multi-level permission verification, and minimize the system running speed.
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 MS. net series of BizTalk 2000 Exchange 2000 and so on, fully support the system built by network components. the JavaBean Component Technology pushed by SUN and IBM makes B/S more mature.
4. Different Software Reuse
The reusability of components is not as good as that of components under B/S requirements.
The multiple structures of B/S pairs require relatively independent components and can be reused relatively well. You can purchase a dining table 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 make an overall investigation to solve the problems and system upgrades. Upgrading is difficult. It may be necessary to create a new system.
B/S components, which can be replaced individually to achieve seamless system upgrade. The system maintenance overhead is minimized. Users can download and install the components online to achieve the upgrade.
6. Different handling problems
The C/S program can fix the user surface and meet high security requirements in the same region. It is related to the operating system and should be the same system.
B/S is built on the Wide Area Network. It targets different user groups and is scattered across regions. This is what C/S cannot do. It has the least relationship with the operating system platform.
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, and most of the difficulties are reduced to reduce 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 thread entity corresponds to a core Lightweight Process, and management between threads is implemented in the off-core function library.
The GDI class is the image device programming interface class library.


119 STRUTS applications (such as STRUTS Architecture)
Struts is an open source framework for developing Web applications using Java Servlet/JavaServer Pages technology. Struts can be used to develop an application architecture based on the Model-View-Controller design pattern. Struts has the following main functions: 1. It includes a controller servlet that can send user requests to corresponding Action objects. II. the JSP free tag Library provides Association support in the controller servlet to help developers create interactive form applications. 3. provides a series of practical objects: XML processing, through Java & n

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.