JSP enterprise interview questions (1)
The three-tier architecture is illustrated, and its features are described. How to implement it and what functions are implemented at each layer? (Enterprise pen exam)
In two-tier applications, the application directly communicates with the database. The layer-3 structure adds an additional logic layer between the user interface code and the database. This layer is usually called the business logic layer ". In the business logic layer, if the first and second layers are on different computers, the technology used by this layer is usually EJB (Enterprise JavaBean) technology, Common Object Request Broker Architecture, and DCOM technology (Distributed Component Object Model, Distributed Component Object Model ). In the Java Enterprise application field, the logic layer can generally be HTML, applet, and JSP, and the business logic layer is generally implemented using EJB.
Which three versions of Java are included? What are the functions of each version and the application fields of each version?
Sun introduces the sun-one (Sun Open Network Environment) strategy with J2EE as the core. This strategy includes three parts: j2se (Java 2 Standard Edition, Java 2 Standard Edition) java 2 Micro Edition, Java 2 Micro Edition, and J2EE.
J2se: a Java platform used to create typical desktop and workstation applications. In terms of configuration, as long as JDK (Java Development Kit) is installed, a j2se development and operation platform is established.
It is mainly used to create embedded applications (such as PDAs and Instruments). The j2se development platform is supported by the j2se platform. The development fields include: high-end information appliances, such as TV set-top boxes, network TVs and Network Visual telephones, and low-end information appliances, such as mobile phones, pagers, and PDAs.
The task of J2EE is to provide an independent, portable, multi-user, secure, and standard enterprise-level platform. The server deployment is completed using Java technology. J2EE is mainly used to create scalable enterprise applications, including 13 core technical specifications.
1-3 Glossary: ejb jndi rmi. (Enterprise pen exam)
EJB (Enterprise Java Bean, enterprise-level JavaBean) is the core technology of the J2EE system. It provides a framework to develop distributed business logic, significantly simplifies the development of scalable and highly complex enterprise-level applications
JNDI (Java Naming and Directory Interface, Java Naming and Directory Interface) is used for name and directory services. It provides consistent interfaces to access and operate enterprise-level resources, such as DNS (Domain Name Service) and local file system
RMI (Remote Method invocation, remote method call) RMI calls some methods on remote objects and uses continuous methods to transmit data on the client and server. Rmi is the basis of EJB technology.
JSP enterprise interview questions (2)
2-1 describes the core mechanism of the Java language.
Java includes three core mechanisms: Java virtual machine, garbage collection, and code security detection.
1. Java Virtual Machine (JVM)
A computer simulated by software or hardware on a computer. The Java Virtual Machine reads and processes platform-independent bytecode class files that have been compiled.
2. Garbage Collection)
In C/C ++ and other languages, programmers are responsible for recycling useless memory. The Java language removes the programmer's responsibility to reclaim useless memory space. It provides a system-level thread to track the distribution of storage space. When the JVM is idle, check and release the storage space that can be released. Garbage collection is automatically executed during Java program running, so programmers cannot control and intervene accurately.
3. Code Security Detection)
During Java code execution, the JVM checks the security of the running code. When some illegal operations, such as modifying some system settings, the JVM will issue a warning.
2-2 compare the differences between basic data types and reference data types.
Java has eight basic data types: Four integer types (byte, short, Int, and long) and two floating point number types (float and double ), A character type (char) and a boolean type (Boolean ).
In Java, data types other than the eight basic data types are referred to as reference types, or composite data types. The referenced type variable declared in the program is only a name for the object, or a reference to the object. The value of the variable is the storage address of the object in the memory space rather than the object itself, this is why we call it the reference type.
2-4 What is the role of Constructors? Briefly describe the benefits of the overloaded constructor.
Constructor is also called constructor. It is a special method in a Java class. Its function is to create a new object of its type. Syntax rules for declaring constructor are as follows:
<Modifiers> <class_name> ([<argu_list>]) {
[<Statements>]
}
We can see that the difference between a constructor and a common method is that the constructor has no return value type, and the constructor must have the same name as its class.
When defining a Java class, you can define one or more constructor methods as needed. Initialization is usually performed in the constructor.
2-5 briefly describe the functions and functions of super, static, and final.
If a method is overwritten in the subclass, The subclass object can call the method before the parent class rewriting. the Java language allows the subclass to use the keyword "super" to reference the method of the parent class.
When declaring attributes and methods in a Java class, you can use the keyword static as the modifier. Static variables or methods are shared by the entire class. For example, if the access control permission permits, you can directly use the class name to add '.' instead of creating this class object.
When declaring classes, attributes, and methods in Java, you can use the keyword final to modify them. The final component has the "final state" feature. The specific provisions are as follows:
L The class marked by final cannot be inherited.
L Methods marked by final cannot be overwritten by the quilt class.
L final-labeled variables (member variables or local variables) become constants and can only be assigned once.
2-6 set elements: Set, hash, and enumeration features and functions.
Common Set elements include vector, enumeration, hashtable, and properties.
Vector does not require the same type of each element. Multiple data types can be mixed in a vector. The vector can be dynamically increased when an element is added.
Vector provides ordered access to the set content. The hash can randomly access the set content. The main methods and descriptions provided by the hash are as follows.
L use put (Object key, object value) to add a keyword/value pair
L get the value of a keyword with get (Object key)
Enumeration can also store many elements. It is generally used to store the return values of other sets.
What is the difference between the 2-7 keyword throw and throws? (Enterprise pen exam)
You can use the throw keyword to throw an exception.
Throws are generally used when defining a function, indicating that an exception is thrown when the function is called.
2-8 what are the advantages of Java thread implementation in several ways?
There are two ways to create a thread: using the runnable interface and inheriting the Thread class. Use the runnable interface implementation class to provide the thread body, which is the basic way to create a thread. You can also create a thread by directly inheriting the Thread class, overwriting the run () method, and using it as the thread body,
There are two differences between the two thread creation methods.
L when using the runnable interface to create a thread, you can separate the CPU, code, and data to form a clear model. The class where the run () method of the thread body is located can also inherit some useful attributes or methods from other classes, and maintain the consistency of the program style.
L when the Thread class is directly inherited to create a thread, the thread subclass cannot be inherited from other classes. But this case is easy to write. The current object of the run () method is a thread object and can be directly manipulated.