1. What are the object-oriented features 1. Abstraction: Abstract is ignored those aspects that have nothing to do with the current goals in a topic in order to pay more attention to the current goals. Abstract does not intend to understand all the questions, but just choose some of them, temporarily do not use some details. Abstract includes two aspects, one is abstract, and the other is data abstraction. 2. Inheritance: Inherit is a hierarchical model of a linkage, and allows and encourages the reuse of classes, which provides a clear expression of a commonality. A new class of an object can be derived from the existing class, which is called class inheritance. New categories inherit the characteristics of the original class, the new class is called the original class (subclass), and the original class is called a new class (parent class). Detective classes can inherit methods and instance variables from its base class, and class can modify or add new methods to make it more suitable for special needs. 3. Package: The package is surrounded by the process and data, and the access to the data can only pass through the defined interface. Object-oriented calculations began in this basic concept, that is, the real world can be depicted into a series of complete autonomous, encapsulated objects, which access other objects through a protected interface. 4. Polymorphism: Polymorphism means that different class objects are allowed to respond to the same message. Polymorphisms include parameterized polymorphisms and polymorphisms. The polymorphic language has the advantages of flexible, abstract, behavioral sharing, code sharing, and well solves the application function of the same name. 2, String is the most basic data type? Basic data types include Byte, int, char, long, float, double, boolean, and short. The java.lang.string class is final type, so this class cannot be inherited, and this class cannot be modified. In order to improve efficiency, we should use StringBuffer class 3, int and integer to provide two different types: reference types and original types (or built-in types). INT is the original data type of Java, and Integer is a package class provided by Java for INT. Java provides package classes for each original type. The original type package BooleanBooleanCharChacterbytebyteshortShortintintegerlongLongFloatFloatDoubledouble reference type and the original type of behavior is completely different, and they have different semantics. Reference Types and Original Types have different features and usage, including: size and speed problems, this type of data structure store, when the reference type and the original type are used as an instance data of a class Default. The default value of the object reference instance variable is NULL, and the default value of the original type instance variable is related to their type. 4, the difference between String and StringBuffer Java platform provides two classes: String and StringBuffer, which can store and operate strings, which contain characters data of multiple characters. This String class provides a string of values that cannot be changed. The string provided by this StringBuffer class is modified. You can use StringBuffer when you know that character data is changed. Typically, you can use StringBuffers to dynamically construct character data. 5. What is the difference between abnormality at runtime? An abnormality indicates the abnormal state of the program during operation, and the runtime exception indicates an exception that may be encountered in the usual operation of the virtual machine is a common run error. The Java compiler requires that the method must declare that the possible non-running abnormality, but does not require a statement that the abnormality that is not captured. 6. Say the life cycle of the servlet and say the difference between servlet and cgi.
After the servlet is instantiated by the server, the container runs its init method, the request is reached, the service method is automatically dispatched with the DOXXX method (Doget, DOPOST) corresponding to the request, and calls its Destroy when the server decides to destroy the instance. method. The difference from the CGI is that the servlet is in the server process, which runs its service method by multithreading, and an instance can serve multiple requests, and its instance is generally not destroyed, and CGI has a new process for each request. After the service is completed, it is destroyed, so it is less efficient than servlet. 7. Say that ArrayList, Vector, LinkedList's storage performance and feature ArrayList and Vector are stored in an array. The number of elements is greater than actually stored in order to increase and insert elements, they all allow direct sequence number index elements, but Inserting element involves memory operation such as array element movement, so the index data is fast and inserted. Need to be forward or rearward, but only the front and rear items of this item are required when inserting data, so the insert is faster. 8, EJB is based on which technologies are implemented? And said the difference between SessionBean and EntityBean, the difference between STATEFULBEAN and STATELESSBEAN. EJB includes session beans, Entity Beans, JNDI, RMI, JAT, etc. SessionBean is used in the J2EE application to complete some server-side business operations, such as accessing the database, calling other EJB components. EntityBean is used to represent the data used in the application system. For clients, SessionBean is a non-persistent object that implements certain business logic running on the server. For clients, EntityBean is a persistent object that represents an object view that stores entities in a persistent memory, or an entity implemented by existing enterprise applications. Session Bean can also be subdivided into Stateful Session Bean with Stateless Session Bean. Both Session beans can perform system logic in Method, and the different is the stateful session bean to record the caller's status, so usually Say, a user will have an entity of a corresponding Stateful Session bean. Although Stateless Session Bean is also a logical component, but he is not responsible for recording the user's state, that is, when the user calls Stateless Session Bean, EJB Container does not look for the specific STATELESS SESSION BEAN entity to perform this Method. In other words, it is very likely that several users are executing the same bean's instance when executing a STATELESS SESSION bean's Methods. From memory, Stateful Session Bean compares the STATELESS SESSION bean, and Stateful Session Bean consumes more memory more than J2EE Server, but the advantage of the Stateful Session bean is that he can maintain the status of the user.
9, the difference between Collection and Collectes. Collection is the superiors of the collection class, inheriting the interface with his interface, mainly SET and List.Collections are a help class for the collection class, and he provides a series of static methods to achieve search, sorting, thread security for various sets. . 10, & and &&. & A bit operator, representing bit and operation, && is a logical operator, representing logic and (AND). 11, the difference between HashMap and HashTable. HashMap is a lightweight implementation of HashTable (non-thread security), they all completed the MAP interface, mainly distinguishing the HashMap allows empty (NUY) key value (key), due to non-threaded security, efficiency may be higher than HashTable. Hashmap allows null as a key or value of Entry, while HashTable is not allowed. Hashmap removes the HashTable's Contains method, changed to ContainSvalue and Containskey. Because the Contains method is easy to cause misunderstandings. HashTable inherits from the Dictionary class, and HashMap is an implementation of the Map Interface introduced by Java 1.2. The biggest difference is that the HashTable method is Synchronize, and HashMap is not, when accessed HashTable, does not need to be synchronized for its method, and HashMap must provide external synchronization. Hash / rehash algorithms used by HashTable and Hashmap are probably, so performance will not have a big difference. 12, Final, Finally, Finalize distinction. Final is used to declare attributes, methods, and classes, indicate that attributes are unambiguous, and the method is not covered, and the class cannot be inherited. Finally is part of an exception handling statement structure, which is always executed. Finalize is a method of the Object class. This method of recycling object is called when the garbage collector is executed, and other resource recycles when this method is available, such as turning off files. 13, SLEEP () and WAIT () What is the difference? Sleep is a thread method, causing this thread to suspend the specified time, give other threads, but monitoring status remains, and automatically recovered . Calling SLEEP does not release the object lock. WAIT is the object of the object class. Call the WAIT method for this object causes the lecture to abandon the object lock. Enter the waiting lock pool waiting for this object, only the NOTIFY method (or NotifyAll) is issued after this object, after entering the object lock pool ready to get Object locks enter the operating state. 14, the difference between overload and override. OverLoaded method can change the type of return value? Override Overriding and overload overloading is a different manifestation of Java polymorphism. Overriding Overriding is a manifestation of polymorphism between parent class and subclasses, and overloading overloading is a manifestation in a class. If a method is defined in the subclass with the same name and parameters as its parent class, we say that this method is overriddled. When the subject of subclass uses this method, the definition of the subclass will be called. For it, the definition in the parent class is like "shielded". If a plurality of the same names are defined in a class, they or have different parameters or different parameter types, called overloading.