Based on JAVA

1 JAVA 】 【basic knowledge related to JAVA
Basic knowledge of JAVA-related
1, object-oriented aspects of the characteristics of which
1. Abstract:
Abstract is that it has overlooked a theme has nothing to do with the current objectives of those aspects in order to more fully with the current objectives of the attention-related aspects. Abstract does not intend to understand all the issues, but only select one part of the moment do not have some details. Abstract two aspects, first, the process of abstraction, and the other is data abstraction.
2. Succession:
Linked inheritance is a kind of hierarchical model, and to allow and encourage the reuse category, it provides a clearly stated common methods. A new type of object can be derived from existing classes, this type of process is known as succession. New class inherits the characteristics of the original category, the new category known as the original type of derived class (subclass), while the original category as a new type of base class (parent class). Derived class can see from its inherited base class methods and instance variables, and categories can be modified or new methods to make them more suitable for particular needs.
3. Packaging:
The package is surrounded by the processes and data, and access to data only through defined interfaces. Object-oriented computing began in the basic concept of the real world can be portrayed as a series of full self-government package of objects, these objects through a protected interface to access other objects.
4. Polymorphisms:
Polymorphism refers to different types of objects allowed to respond to the same message. Including parametric polymorphism and inclusion polymorphism polymorphism. Polymorphism flexible language, abstract, behavior sharing, code-sharing advantages of good application function to solve the problem of the same name.

2, String is the most basic data types it?
Basic data types include byte, int, char, long, float, double, boolean and short.
final category is the type of java.lang.String, and therefore can not inherit this class, this class can not be amended. In order to improve the efficiency of space-saving, we should use StringBuffer Class

3, int and Integer What is the difference between
Java offers two different types: reference types and primitive types (or built-in type). Int is primitive java data type, Integer is a java package provided for the int type. Java primitive type for each category of the package.
The original type of package type
booleanBoolean
charCharacter
byteByte
shortShort
intInteger
longLong
floatFloat
doubleDouble
Reference types and primitive types of behavior is totally different, and they have different semantics. Reference types and primitive types have different characteristics and usage, they include: the size and speed, this type of data structure the type of storage, when the reference type and the type used for the original example of a data type specified in default values. Object reference instance variables of the default value is null, while the original type of the default values instance variables with their type.

4, String and StringBuffer difference
JAVA platform provides two classes: String and StringBuffer, which can be stored and operation of the string that contains a number of characters in character data. The String class provides a numerical string can not be changed. The StringBuffer class provides for modification of the string. When you know the character data to change when you can use StringBuffer. Typically, you can use to dynamically StringBuffers character data structure.

5, run-time anomalies and anomalies of the similarities in general?
Anomaly that is running that may occur in a state of non-normal, run-time anomaly that is usually a virtual machine operation that may be encountered in the abnormal operation is a common error. java compiler must request a statement that may arise out of non-run-time anomaly, but does not require a statement has not been caught out run-time anomaly.

6, say Servlet life cycle, and tell the difference between Servlet and CGI.
Servlet instantiated by the server, the container is running its init method, the request arrived to run the service method, service method of automatically sending a request to run with the corresponding doXXX methods (doGet, doPost) and so on, when the server decided to call a time when examples of the destruction of its destroy method.
The difference is that with cgi server process in a servlet, it runs through its multi-threaded service methods, an example can be served on a number of requests, and the examples of the general will not be destroyed, and CGI requests are generated for each new process services after the completion of the destruction, so the efficiency is lower than the servlet.

7, to say ArrayList, Vector, LinkedList and storage performance characteristics
ArrayList and Vector are stored using an array of data, the number of array elements is greater than the actual data stored in order to increase and to insert elements, which are indexed by serial number to allow the direct elements, however, to insert the element of the array elements involved in mobile operations, such as memory, so index data fast and slow insert data, Vector methods of the use of synchronized (thread-safe), usually worse performance than the ArrayList, and LinkedList list used to achieve two-way storage, indexed by serial number before the data needs to traverse to or after , but only need to insert the data before and after record of this can be, so insert faster.

8, EJB technology is based on the realization of what? And SessionBean and EntityBean tell the difference, StatefulBean and StatelessBean difference.
EJB including the Session Bean, Entity Bean, Message Driven Bean, based on JNDI, RMI, JAT and other technology.
SessionBean in J2EE applications are used to complete a number of server-side operations, such as access to the database, call other EJB components. EntityBean application system is used to represent the data used.
For the client, SessionBean is a non-persistent object that the achievement of some running on the server business logic.
For the client, EntityBean is a persistent object, it represents a memory stored in the persistent object in view of the entity, or an existing enterprise applications to achieve the entity.
Session Bean can also be subdivided into Stateful Session Bean and Stateless Session Bean, both the Session Bean can be placed on the system logic of the implementation method, unlike the Stateful Session Bean can record the caller's state, it is often to that a user will have a corresponding entity of the Stateful Session Bean. Stateless Session Bean Components While the logic is, but he did not record the user is responsible for the state, that is to say when a user calls a Stateless Session Bean time, EJB Container will not find a specific entity of Stateless Session Bean to implement this method. In other words, the most likely number of users in the implementation of certain methods of Stateless Session Bean, the Bean will be the same in the implementation of the Instance. From memory point of view, Stateful Session Bean and Stateless Session Bean comparison, Stateful Session Bean consume more J2EE Server memory, however, the advantage of Stateful Session Bean is that he can maintain the status of the user.

9, Collection and the Collections of the difference.
Collection is a collection of superior class interfaces, interface inheritance and his main Set and List.
Collections is a collection of class categories to help, he provides a wide range of static methods to search a variety of collection, sorting, such as thread-safe operation.

10, & and & & the difference.
& Is an operator, said that with the bitwise operator, & & is a logical operator that logic (and).


Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:47 <input maxlength="2147483647" size="20" type="hidden" value=" [JAVA] Java related basics "> reply to this statement



2 Re: JAVA 】 【basic knowledge related to JAVA
11, HashMap, and the difference between Hashtable.
HashMap is the realization of lightweight Hashtable (the realization of non-thread-safe), they completed the Map interface, the main difference is that HashMap allows empty (null) key (key), as a result of non-thread-safety, efficiency may be higher than Hashtable.
HashMap allows null as a key or entry of value, while Hashtable does not allow.
Contains the Hashtable to HashMap methods removed, replaced by containsvalue and containsKey. Because it contains could easily lead to misunderstanding.
Dictionary category inherited from Hashtable, HashMap is the Java1.2 introduced an implementation of Map interface.
The biggest difference is that, Hashtable is to Synchronize, and not a HashMap, Hashtable in a number of threads to visit when the need for its own methods to achieve synchronization, and the HashMap must provide external synchronization.
Hashtable and HashMap using the hash / rehash algorithm are probably the same, so there will be no significant performance differences.

12, final, finally, finalize the distinction.
final statement for the properties, methods, and types of attributes that can not be changed, methods of non-coverage, type can not be inherited.
finally exception handling statement is part of the fabric that is always the implementation. Type can not inherit
finalize is a method of Object class, the implementation of the garbage collector will call when the object was the recovery of this method, you can override this method to collect waste from other resources at the time of recovery, such as the closure of files.

13, sleep () and wait () What is the difference?
sleep is a type of thread (Thread) method, resulting in the suspension of the thread specified period of time, to the Executive the opportunity to other threads, but still monitor the state, after that time will automatically resume. Call sleep will not release the object lock.
wait is the Object class methods, call the wait method on this object led to give up the Thread object locks, waiting to enter the lock waiting for the object pool, the only issue for this object notify method (or notifyAll) only after the thread locking the object into the pool ready access to the operational state of the object lock.

14, Overload and the difference between Override. Overloaded methods can change the type of the return value?
Method Overriding and overloading Overloading rewriting is different from the performance of Java polymorphism. Overriding is the father of re-writing classes and subclasses of a performance between the polymorphism, overloading Overloading is a category of a manifestation of polymorphism. If the definition of a sub-class methods and his father have the same type name and parameters, we say that the method has been rewritten (Overriding). Subclass of the object using this method will call the definition of sub-category, it is concerned, the definition of the parent category as the "shielding" the. If a class is defined in many ways the same name, they have different parameters or the number of different parameters or the type of method is referred to as heavy (Overloading). Overloaded methods can change the type of return value.

15, error and exception What is the difference?
the resumption of error that is difficult but not impossible, the case of a serious problem. For example, memory overflow. Procedures can not be expected to be able to handle such a situation.
exception that the realization of a design or. In other words, it means that if run properly, never happened.

16, the similarities and differences between synchronous and asynchronous, the circumstances under which they were used? Example.
If data will be shared between threads. For example, data is being written by another thread may read or is reading the data may have been written by another thread, then the data is shared data, access must be synchronized.
When the application calls an object takes a long time to implement the methods, procedures and do not want to wait for the return method, you should use asynchronous programming, and in many cases tend to adopt more efficient means of asynchronous .

17, abstract class and interface What is the difference?
Method statement and not to realize the existence of the category it has been called abstract class (abstract class), it is used to create a manifestation of certain basic types of behavior and methods of such a statement, but it can not achieve in such kind of situation. Can not create instance of abstract class. However, you can create a variable, its type is an abstract class, and make it point to a specific sub-category of a case in point. Constructor can not be abstract or abstract static methods. Abstract class for their sub-class father of all types of methods for the realization of the abstract, they are also for the abstract class. Instead, in the sub-class to achieve the method. Know the behavior of other types of categories can be achieved in these methods.
Interface (interface) is a variant of abstract class. Interface, all methods are abstract. Multiple inheritance can be adopted to achieve this kind of interface and access. All interface methods are abstract, there is no body of a procedure. Interface can only be a member of the definition of static final variables. Interface with the sub-category is similar, in addition to the implementation class can not inherit from the interface definition of behavior. When the class implements a special interface, it is the definition of (the procedure body is about to give) all of the methods of this interface. Then, it can achieve the interface of any object method call interface. Abstract class because it allows the use of interface name as the reference variable type. The usual dynamic binding will take effect. Reference can be converted to the interface type, or conversion from interface type, instanceof operator can be used to determine whether a particular type of object to achieve the interface.

18, heap and stack What is the difference between.
Stack is a linear collection of elements to add and delete operations should be completed in the same period. Stack in accordance with the last-in first-out manner.
Reactor is an integral element of the stack

19, forward and redirect the difference between
forward the request of the server resources, direct access to the target server address URL, the URL to the content read from the response, and then re-distributed to them the contents of the browser, the browser did not know the content server from where, so It's the address bar or the address of the original.
Server-side redirect is based on logic, send a status code, telling the browser to re-request the address, the browser will generally just re-request all the parameters of the request, the session, request parameters are available.

20, EJB and JAVA BEAN difference?
Java Bean is a reusable component, the Java Bean does not strictly regulated, in theory, any Java type can be a Bean. However, under normal circumstances, because of Java Bean is created by the container (eg Tomcat), so Java Bean should have a constructor without parameters, In addition, Java Bean usually Serializable interface is used to achieve the realization of the persistent Bean. Java Bean in fact equivalent to Microsoft's COM model of the local process COM components, it can not be inter-process visit. Enterprise Java Bean is equivalent to DCOM, or Distributed Component. It is based on Java's Remote Method Invocation (RMI) technology, it can be EJB remote access (inter-process and inter-computer). But the EJB must be deployed in such Webspere, WebLogic containers such, EJB clients never directly access the real EJB components, but the container through its visit. EJB containers EJB proxy components, EJB components created by the container and management. Customers to access real container EJB components.

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:48 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



3 Re: JAVA 】 【basic knowledge related to JAVA
21, Static Nested Class and different Inner Class.
Static Nested Class declaration is static (static) internal class, it can not rely on an external instance of a class that was instantiated. Usually, the need for an internal type of the external type of examples in order to instantiate.

22, JSP dynamic INCLUDE and INCLUDE the difference between static?
INCLUDE with dynamic jsp: include action to achieve it <jsp:include page="included.jsp" flush="true" /> always check the changes contained in the document, suitable for containing dynamic pages, and can take parameters.
Include pseudo-static code using INCLUDE to achieve, will be contained in the document does not check for changes, for a static page that contains <% @ include file = "included.htm"%>

23, when using assert.
assertion (that) in software development is a common way of debugging, many languages support the development of such a mechanism. In the implementation, assertion is a statement of procedures, which check a boolean expression, the proper procedure for a boolean expression must be guaranteed that the value of true; if the value is false, that is not the correct procedures have been in a state of , the system will be given warnings or withdrawal. Generally speaking, assertion assurance procedures for the most basic, the key is correct. assertion checks are usually in the development and testing open. In order to improve the performance, after the software release, assertion checking is usually turned off.

24, GC What? Why should there be a GC?
GC is the meaning of refuse collection (Gabage Collection), memory is the programmers to deal with problem areas prone to forget or recall of memory errors or system would lead to instability or even collapse, Java functions can be provided by automatic monitoring GC whether over scope so as to achieve the purpose of automatic recovery of memory, Java language does not provide the release of the show have been allocated to the memory operation.

25, short s1 = 1; s1 = s1 + 1; What is wrong? Short s1 = 1; s1 + = 1; What is wrong?
short s1 = 1; s1 = s1 + 1; (s1 +1 computing result is type int, the need for mandatory conversion type)
short s1 = 1; s1 + = 1; (compile correctly)

26, Math.round (11.5) equal to how many? Math.round (-11.5) equivalent to the number?
Math.round (11.5) == 12
Math.round (-11.5) ==- 11
round method and parameters to return to the nearest long integer, parameter 1 / 2 for the floor.

27, String s = new String ( "xyz"); the creation of a number of String Object?
Two

28, the design of four threads, two of which each thread of j increase by 1, and the other two threads on j each decrease of 1. Written procedures.
The following types of procedures to achieve the use of internal threads on j does not take time to change the order of the problem.
public class ThreadTest1 (
private int j;
public static void main (String args []) (
ThreadTest1 tt = new ThreadTest1 ();
Inc inc = tt.new Inc ();
Dec dec = tt.new Dec ();
for (int i = 0; i <2; i + +) (
Thread t = new Thread (inc);
t.start ();
t = new Thread (dec);
t.start ();
)
)
private synchronized void inc () (
j + +;
System.out.println (Thread.currentThread (). GetName ()+"- inc: "+ j);
)
private synchronized void dec () (
j -;
System.out.println (Thread.currentThread (). GetName ()+"- dec: "+ j);
)
class Inc implements Runnable (
public void run () (
for (int i = 0; i <100; i + +) (
inc ();
)
)
)
class Dec implements Runnable (
public void run () (
for (int i = 0; i <100; i + +) (
dec ();
)
)
)
)

29, Java has no goto?
reserved word in java, there is no use in java.

30, start a thread is run () or start ()?
Start a thread that calls start () method, so that the thread represented by the virtual processor to run at the state, which means that it can by scheduling and implementation of JVM. This does not mean that the thread will run immediately. run () method can be a sign of the need to withdraw from a thread to stop.

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:49 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



4 Re: JAVA 】 【basic knowledge related to JAVA
31, EJB, including (SessionBean, EntityBean) to tell me their life cycle, and how to manage the affairs?
SessionBean: Stateless Session Bean life cycle is determined by the container when the client sent a request to create a When Bean instance, EJB containers do not have to create a new instance of the Bean for the client to call, but is not looking for a Some examples provided to the client. When the first client to invoke a Stateful Session Bean, the container must immediately on the server to create a new instance of the Bean, and related to the client on the client after the call method of Stateful Session Bean will be called when the containers assigned to this Client Bean associated examples.
EntityBean: Entity Beans can be a relatively long survival time, and the state is a continuous process. As long as there is data in the database, Entity beans have survived. Rather than applications or services in accordance with the process of. Even if the collapse of the EJB container, Entity beans are also survival. Entity Beans can be the life cycle to manage the container or Beans.
EJB technology management practices through the following: Object Management Group (OMG) object of practical services (OTS), Sun Microsystems of the Transaction Service (JTS), Java Transaction API (JTA), Development Group (X / Open) the XA interface.

32, application server, there are those?
BEA WebLogic Server, IBM WebSphere Application Server, Oracle9i Application Server, jBoss, Tomcat

33, to me you most often see a runtime exception.
ArithmeticException, ArrayStoreException, BufferOverflowException, BufferUnderflowException, CannotRedoException, CannotUndoException, ClassCastException, CMMException, ConcurrentModificationException, DOMException, EmptyStackException, IllegalArgumentException, IllegalMonitorStateException, IllegalPathStateException, IllegalStateException, ImagingOpException, IndexOutOfBoundsException, MissingResourceException, NegativeArraySizeException, NoSuchElementException, NullPointerException, ProfileDataException, ProviderException, RasterFormatException, SecurityException, SystemException, UndeclaredThrowableException, UnmodifiableSetException, UnsupportedOperationException

34, the interface interface inheritable? Abstract class can be achieved if (implements) interface? Abstract class is inheritable entity class (concrete class)?
Interface interface can be inherited. Abstract class can be achieved (implements) interface, abstract class is inheritable entity class, but only entity class must have a clear constructor.

35, List, Set, Map is inherited from the Collection interface? Title 9
List, Set is, Map is not

36, to say the work of the data connection pooling mechanism?
J2EE server startup will create a certain number of pool connections, and has been maintained at not less than the number of connection pool. Need to connect the client program, the pool will return to a driver not used to connect the pool table and recorded as busy. If the current connection is not idle, the driver on the new pool a certain number of connections, the number of new connections have decided to configuration parameters. When using the pool to connect calls after the completion of this connection pool driver table entry for free, other calls can use this connection.

37, abstract whether the method is also static, it also is a native, it also is synchronized?
Can not

38, the array has no length () this method? String Is there any length () this method?
Array there is no length () This method has the attributes of length. String there are length () this method.

39, Set in the elements is not repeated, then the method used to distinguish whether or not to repeat it? Is == or equals ()? What is the difference between them?
Set in the elements is not repeated, then the use of iterator () method to distinguish whether or not to repeat. equals () is the two Set whether the same interpretation.
equals () and == means to determine whether the reference point to the same target value equals () has been covered in class in order to separate the two objects when the content and the type of match, then return to true value.

40, whether the constructor Constructor can be override?
Constructor constructor can not be inherited, we can not rewrite Overriding, but can be overloaded Overloading.

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:49 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



5 Re: JAVA 】 【basic knowledge related to JAVA
41, whether the String type can be inherited?
String is the final category can not inherit it.

42, swtich whether the role of the byte, whether in the long role, the role of whether the String?
switch (expr1) in, expr1 is an integer expression. Therefore passed to the switch and case statement should be the parameters int, short, char or byte. long, string can not act on the swtich.

43, try () there is a return statement, then immediately after the try in the finally () in the code will be executed, when executed, before or after in return?
Will be implemented prior to the implementation of the return.

44, the programming problem: with the most efficient way to calculate the equivalent number of 2 multiplied by 8?
2 <<3

45, two targets of the same value (x.equals (y) == true), but may have different hash code, this sentence right?
Not have the same hash code.

46, when an object as parameter to a method, this method can change the properties of this object, and return the result of the changes, then in the end here is the transfer value or reference?
Is passed by value. Java programming language, only the value of transmission parameters. When an object instance as a parameter is passed to the method, the parameter is the object. The contents of the object can call the method was changed, but the object reference will never be changed.

47, when a thread access to an object method of a synchronized, other threads can access to other methods of this object?
Not, an object of a synchronized method can only visit by a thread.

48, the programming problem: to write out a Singleton.
Singleton pattern is to ensure a major role in the Java application, a class that there is only one example of the existence of Class.
Singleton pattern in general usually have several in various forms:
The first is: the definition of a class, its constructor is private, and it has a static type of the private variable initialization in the class instance, then through a public access to the getInstance method to quote it, and then call the method.
public class Singleton (
private Singleton () ()
/ / In their own internal definition of an example, is not it strange?
/ / Note this is private only internal calls private static Singleton instance = new Singleton ();
/ / Here for external access to a static method of this class, you can directly access the public static Singleton getInstance () (
return instance;
)
)
The second form of:
public class Singleton (
private static Singleton instance = null;
public static synchronized Singleton getInstance () (
/ / This method is an improvement over the above, do not have to generate the target every time, but the first time
/ / Used to generate examples of efficiency!
if (instance == null)
instance = new Singleton ();
return instance;)
)
Other forms:
The definition of a class, its constructor is private and all methods of static.
The first is generally considered more secure to some

49, Java interface and C + + of the same type of virtual and differences.
Because Java does not support multiple inheritance, and the possibility of a type or object to be used in a number of categories or objects inside the method or property, the existing single-inheritance mechanism can not meet the requirements. Compared with the inheritance, interfaces, more flexibility, because there is no realization of interface code. When a class implements the interface after the interface type in order to achieve it all the methods and properties and the properties of interface in which the following are the default state of public static, default, all methods are public. A type of multiple interfaces can be achieved.

50, Java's exception handling mechanism and application of a simple principle.
When the JAVA program in violation of the rules of JAVA semantic, JAVA virtual machine errors will be expressed as an exception. Violation of semantic rules, including two kinds of situation. JAVA class library is built-in semantic checks. For example, cross-border array subscript will trigger IndexOutOfBoundsException; access null object will trigger NullPointerException. In other cases, the expansion of JAVA programmer to allow inspection of such semantics, programmers can create their own unusual and freedom to choose when an exception is raised using throw keyword. All exceptions are subclasses of java.lang.Thowable.

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:49 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



6 Re: JAVA 】 【basic knowledge related to JAVA
51, the benefits of garbage collection and theory. And to consider two kinds of recovery mechanisms.
Java language in a prominent feature of this approach is the introduction of garbage collection mechanism to enable c + + programmers the most headache solved the problem of memory management, it allows Java programmers to write programs in a time when no longer need to consider memory management. Because there is a garbage collection mechanism, Java objects are no longer the "scope" concept, only the object reference will have no "scope." Garbage collection can be effective to prevent the memory leak, an effective use of available memory. Garbage collector is usually as a separate thread to run low-level, unpredictable circumstances heap memory or have died a long time the object does not use clear and Recovery, programmers can not be called real-time garbage collector for all objects in an object or carry out waste recovery. Recovery mechanisms have a copy on behalf of garbage collection and marking garbage collection, incremental garbage collection.

52, please say you know the method of thread synchronization.
wait (): make a thread in a wait state, and the release of the object held by a lock.
sleep (): make a thread that is running in a sleep state, is a static method, call this method to capture the abnormal InterruptedException.
notify (): wake up a thread in a wait state, noted that this method is called when the wake-up call can not be the exact state of a thread to wait, but by the JVM to determine which thread to wake up, and not by priority level.
Allnotity (): wake-up call to all Department of the thread into the wait state, wake-up call to all the attention is not a thread locks an object, but allow them to compete.

53, you know what type of collection? The main method?
A collection of the most common category is List and Map. List the specific realization, including ArrayList and Vector, they are a list of variable size, more suitable for construction and operation of any type of storage element of a list of objects. List numerical index for the visit by the case element.
Map provides a more common method of storage elements. Map collection class used to store the elements of (referred to as the "key" and "value"), in which each key is mapped to a value.

54, describe the JVM to load the principle mechanism for class file?
JVM in the class is loaded by the ClassLoader and its subclasses to be achieved, Java ClassLoader is an important component of Java run-time system. It is responsible for run-time in the types of documents to find and load the class.

55, char-type variables can be stored in a Chinese character? Why?
Can be defined as a Chinese, because the java in unicode encoding, accounting for a 16-byte char, so release is not a Chinese problem

56, there are several multi-threaded implementation, what is? Synchronization There are several methods to achieve, what is?
The realization of multi-threaded, there are two methods, namely, the realization of the succession of Thread class Runnable interface
Synchronization in two aspects, which are synchronized, wait and notify

57, JSP's built-in objects and methods.
request that the HttpServletRequest object. It includes the browser requests the information, and to provide for access to a number of cookie, header, and session data useful.
response that the HttpServletResponse object, and provide a few to set the browser back to the method of response (such as cookies, header information, etc.)
out object is an instance of javax.jsp.JspWriter and offers several ways for you to return to the browser output.
that a pageContext object javax.servlet.jsp.PageContext. It is used in a variety of convenient access to the scope of Namespace, servlet object-related API, and packaging of the generic servlet-related functions.
request that a session object javax.servlet.http.HttpSession. Session can store the user's status information
an applicaton that javax.servle.ServletContext object. This helps to find information about servlet engine and servlet environment information
javax.servlet.ServletConfig that a config object. The target for access to servlet instance initialization parameters.
page that the page generated from the example of a servlet

58, the basic concept of threads, thread the basic state, as well as the relationship between the state of the thread refers to the process of implementation procedures, to implement the program code of an executive unit, each process has a thread at least, that is, procedures itself.
Java threads in the four state are: running, ready to hang, the end.

59, JSP common commands
<% @ page language = "java" contenType = "text / html; charset = gb2312" session = "true" buffer = "64kb" autoFlush = "true" isThreadSafe = "true" info = "text" errorPage = "error. jsp "isErrorPage =" true "isELIgnored =" true "pageEncoding =" gb2312 "import =" java.sql .*"%>
isErrorPage (whether or not to use Exception object), isELIgnored (whether the expression ignored)
<% @ include file = "filename"%>
<% @ taglib prefix = "c" uri = " http:// ...... "%>

60, under what circumstances to call doGet () and doPost ()?
Jsp page label in the form of the method attribute to get the time to call doGet (), for the post when the call doPost ().

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:50 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



7 Re: JAVA 】 【basic knowledge related to JAVA
61, servlet life cycle
web container load servlet, the beginning of the life cycle. By calling the servlet's init () method to initialize the servlet. By calling the service () method, in accordance with the request to call the different methods do ***() different. The end of services, web container servlet call the destroy () method.

62, how the reality of the single-threaded model servlet
<% @ Page isThreadSafe = "false"%>

63, page transmission method between the object
request, session, application, cookie, etc.

64, JSP and Servlet What are the similarities and differences between them what is the link?
JSP is an extension of Servlet technology, in essence, is the easy way to Servlet, more emphasis on the appearance of the application of the expression. After the JSP compiler is a "category servlet". Servlet and JSP The main difference is, Servlet's application logic in the Java file, and that entirely from the HTML layer in separated. JSP is the Java and HTML can be combined into one extension. Jsp document. JSP focuses on the view, Servlet mainly used for control logic.

65, four session scope session tracking technology ServletsJSP page description
on behalf of any page with a page-related objects and attributes. A page compiled by a Java servlet class (can include with any instructions, but did not include action) said. This includes both servlet and compiled into a servlet, including the JSP page
is the request on behalf of the client and the Web of a request issued by the relevant objects and attributes. A request is likely to span multiple pages, involves a number of Web components (due to forward instructions and include the relationship between movements)
is the session on behalf of and for a Web client, a user experience-related objects and attributes. A Web session can and often across multiple client requests
is the application on behalf of the entire Web application-related objects and attributes. This is essentially across the entire Web applications, including multiple pages, requests and the overall scope of a conversation

66, Request object's main method:
setAttribute (String name, Object): Set the name of the request for the name of the parameter values
getAttribute (String name): return the name of the attribute value specified
getAttributeNames (): return to request the names of all the attributes of the object collection, the result is an example of enumeration
getCookies (): return to the client all the Cookie object, the result is an array of Cookie
getCharacterEncoding (): return the request character encoding
getContentLength (): return the length of the request of the Body
getHeader (String name): access to the HTTP protocol definition file header information
getHeaders (String name): return the request Header specify the name of all the values, the result is an example of enumeration
getHeaderNames (): return the name of the request Header Therefore, the result is an example of enumeration
getInputStream (): return the request input stream for the data access request
getMethod (): access to server-side client to send data
getParameter (String name): send it to the client access to server-side name of the parameter values specified
getParameterNames (): access to the client send to server-side the names of all the parameters, the result is an example of enumeration
getParameterValues (String name): access to the designated name of all the values of the parameters
getProtocol (): access to the client to transmit data to the server-side protocol is based on the name of
getQueryString (): access to query string
getRequestURI (): string of a request to obtain the client address
getRemoteAddr (): access to the IP address of the client
getRemoteHost (): access to the client's name
getSession ([Boolean create]): return and request the relevant Session
getServerName (): access to the server's name
getServletPath (): the client requested access to the script file path
getServerPort (): access to the server port number
removeAttribute (String name): request to delete an attribute

67, J2EE is a technology or platform or framework?
J2EE is a standard, a distributed application for enterprise development of the standard platform.
J2EE is a framework, including JDBC, JNDI, RMI, JMS, EJB, JTA, etc. techniques.

68, web application development, we often encountered in the process of encoding the output of a character, such as iso8859-1, such as how to output a certain string encoding?
Public String translate (String str) (
String tempStr = "";
try (
tempStr = new String (str.getBytes ( "ISO-8859-1"), "GBK");
tempStr = tempStr.trim ();
)
catch (Exception e) (
System.err.println (e.getMessage ());
)
return tempStr;
)

69, on the logic of operation and conditions of operation (&,|,^) distinction (&&,||).
A major difference between two points: a. the conditions of operation can only Boolean operations, and logic operations can not only Boolean operations, and can operate numerical
b. the operation does not produce short-circuit logic

70, XML documents there are several forms of the definition? What is the nature of the distinction between them? Analysis of XML documents which a number of ways?
a: two forms dtd schema, b: the essential difference between: schema is xml, the XML parser can resolve (this is also the schema from the DTD on the fundamental purpose of development), c: there are DOM, SAX, STAX, etc.
DOM: when dealing with large files very powerful performance. This problem is caused by the DOM tree structure created by this structure occupy more memory, and the DOM document must resolve before the entire document into memory for random access to XML
SAX: not now on the DOM, SAX is event-driven XML-based analytical methods. It order to read XML documents, do not need to load the entire file all at once. When the document as the beginning of the end of the document, or label with the label at the beginning of the end, it will trigger an event, the user through the callback event handling code written to handle XML documents, for the sequential access to XML
STAX: Streaming API for XML (StAX)

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:50 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



8 Re: JAVA 】 【basic knowledge related to JAVA
71, on the similarities and differences between synchronized and java.util.concurrent.locks.Lock?
Main the same point: Lock can be synchronized by the achievement of the completion of all the features of the main differences: Lock more accurate than the thread synchronized semantics and better performance. will be automatically synchronized to release locks, and Lock programmers must be manually released, and must be released in the finally clause.

72, EJB and the role of the three objects
A complete EJB-based distributed computing architecture composed of six roles, the role of these six can be provided by different developers, each role must be followed by the Sun to provide the EJB specification in order to ensure mutual compatibility. The six roles are developer EJB components (Enterprise Bean Provider), the application of combination of those (Application Assembler), the deployment of those (Deployer), EJB server provider (EJB Server Provider), EJB container provider (EJB Container Provider) , the system administrator (System Administrator)
Three targeted Remote (Local) interface, Home (LocalHome) interface, Bean Class

73, EJB container services provided by the main provider of the statement cycle management, code generation, continuity management, security, transaction management and distributed management of locks and other services.

74, EJB in the EJB specification provisions which prohibited the operation?
1. Can not operate the thread and thread API (refer to non-thread-thread API object, such as notify, wait, etc.), 2. Inoperable awt, 3. Not the server function, 4. Can not survive on a static check, 5. IO operation can not use direct access to the file system, 6. can not load the local library., 7. can not be this as a variable and return, 8. can not be called the cycle.

75, remote interface and home interface a major role
remote interface defines the business methods for the EJB client calls business methods.
EJB Factory home interface is used to create and remove EJB to find examples of

76, bean instance for the life cycle of Stateless Session Bean, Entity Bean, Message Driven Bean in general the existence of buffer pool management, and for the Entity Bean and Statefull Session Bean exist Cache management, usually to create instances, set the context, the creation of EJB Object (create) business method call, remove, etc., for the existence of buffer pool management, Bean, in the following examples do not create clear from memory, instead of using the buffer pool examples of scheduling mechanisms for continuous reuse, and management for the existence of Cache through the activation of the Bean and to Bean activation mechanisms of the state and limit the number of memory instances.

77, EJB activation mechanism to Stateful Session Bean as an example: the Cache memory size determines the existence of the Bean at the same time the number of instances, in accordance with MRU or NRU algorithm, an example in the activation and de-activation between the migration mechanism is activated when the EJB client calls a business method of example, if the corresponding EJB Object not found itself bound Bean instance from the corresponding activation of the Bean store to go (through the mechanism of storage instance sequence) return (activated) in this example. State transition will be called before the corresponding method ejbActive and ejbPassivate.

78, EJB types of conversations (Session) Bean, Entity (Entity) Bean Message Driven (Message Driven) Bean
Session Bean can be divided into Stateful (Stateful) and non-state (Stateless) can be divided into two entities Bean of Bean managed persistent (BMP) and container-managed persistent (CMP) in two

79, customer service EJB client calls the object a few basic steps to set up factories and JNDI Services Address System Properties JNDI service to find Home interface call from the Home Interface Remote Interface Create method to create, through the Remote interface methods to call their business.

80, how to specify the size of the memory weblogic?
Weblogic startup script (in which the corresponding Domian server directory startServerName), increased set MEM_ARGS =- Xms32m-Xmx200m, can be adjusted for minimum memory 32M, the largest 200M

Author: Nong Gu
<noscript> </ noscript>

2007-12-23 14:51 <input maxlength="2147483647" size="20" type="hidden" value=" Reply : [JAVA] Java related basics "> reply to this statement



9 Re: JAVA 】 【basic knowledge related to JAVA
81, how to configure weblogic for the hot start mode (development mode) and product release mode?
Management Console can be modified in the corresponding server startup mode for the development of one model or product. Or modify the service startup file or document commenv to increase the set PRODUCTION_MODE = true.

82, how to start, is not required to enter a user name and password?
Service startup files modified to increase the item WLS_USER and WLS_PW. Boot.properties documents can also be added in the encrypted user name and password.

83, in Taichung weblogic management of an application domain (or a Web site, Domain) for jms and ejb or connection pool configuration and other related information, the actual documents stored in what?
Stored in the Domain in the config.xml file, which is the core of the server configuration file.

84, to talk about weblogic a Domain default directory structure? For example, to a simple directory helloWorld.jsp Add to Ho, but in the browser can break into the http:// Host: port number / / helloword.jsp can be seen on the results? Another example, which used a javaBean wrote it myself how to do?
Domain Directory directory server applications, the directory will be applied on this directory as the application will be able to visit, in the case of Web applications, application directory needs to meet the requirements of Web application directory, jsp files can be applied directly on the directory, Javabean need on the application directory WEB-INF directory of the classes directory, set the default application server will be able to achieve in your browser without the application of input.

85, ejb in weblogic to be involved in the release to which different types of configuration files involved in the EJB configuration file is different from all involved, including the configuration file ejb-jar.xml, weblogic-ejb-jar.xmlCMP Entity Bean in general also need to weblogic - cmp-rdbms-jar.xml

86, How to configure weblogic in ssl client authentication configuration, or to talk about j2ee (standard) configuration for ssl to use the default installation DemoTrust.jks KeyStore achieve DemoIdentity.jks and SSL, need to configure the server using the Enable SSL, configure their port, in the product model needs to obtain from the CA private key and digital certificate, create identity and trust keystore, loading access to the keys and digital certificates. SSL can be configured to connect this is a one-way or two-way street.

87, How can I see in the weblogic has released EJB?
Can use the Management Console, in its Deployment can view all of the EJB has been published

88, CORBA is about? What is the purpose?
CORBA standard is CORBA (Common Object Request Broker Architecture), by the Object Management Group (Object Management Group, the acronym for the OMG) standardization. It is composed of the Interface Definition Language (IDL), language bindings (binding: Binding also translated) and to allow interoperability between the application of the agreement. Its purpose is: to use a different programming language written in a different process to run different operating systems development.

89, like you are familiar with or have heard of several of the j2ee common mode? And design patterns for some of the views of Session Facade Pattern: the use of EntityBean visit SessionBean
Message Facade Pattern: Asynchronous calls
EJB Command Pattern: Use Command JavaBeans replace SessionBean, the realization of lightweight access
Data Transfer Object Factory: through the DTO Factory provides features to simplify data EntityBean
Generic Attribute Access: through AttibuteAccess interface provides features to simplify data EntityBean
Business Interface: the adoption of long-range (local) interface and the Bean class implements the same interface specification EJB business logic consistency of the design of the structure will directly affect the quality of system performance, scalability, maintainability, reusability of components and development efficiency. The more complex the project, the project team can be more substantial the more the importance of good design.

90, to talk about the development of information in the weblogic when Bean and persistent differences in non-persisten
persistent approach to ensure that the MDB messaging reliability, which is a problem if the EJB container and JMS message server will still be available at this time MDB sent, and the mode of non-persistent messages will be discarded.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Based on JAVA

  • Great collection of java interview topics

    1, object-oriented features of what has 1. Abstract: Abstract is that it has overlooked a subject has nothing to do with the current goal of those aspects in order to more fully with the current objectives of the attention-related aspects. Abstract d ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries