Java related basics (2)

xiaoxiao2021-03-06  19

20. The difference between EJB and Java Bean? Java bean is a reused component that does not have a strict specification for Java Bean. In theory, any Java class can be a bean. In general, since the Java bean is created (such as Tomcat) by the container, the Java Bean should have a 11-free constructor, in addition, the Java Bean also implements the Serializable interface to implement the persistence of beans. Java Bean is actually equivalent to the COM component in the local process in the Microsoft COM model, which cannot be accessed across the process. Enterprise Java Bean is equivalent to DCOM, ie distributed components. It is based on Java-based remote method call (RMI) technology, so EJB can be remotely accessed (cross processes, cross-computers). But EJB must be deployed in a container such as WebSpere, WebLogic, and EJB customers never access true EJB components, but access them through their container. The EJB container is an agent of EJB components, and the EJB component is created and managed by the container. The client accesses the real EJB component through the container. 21, Static Nested Class and Inner Class are different. Static NESTED CLASS is an internal class that is declared as static (STATIC), which can not depend on external class instances being instantiated. The usual internal classes need to be instantiated after instantification of external classes. 22. Different Dynamic Include and Static Include in JSP? Dynamic include uses JSP: Include action to implement It always checks changes in the file included in the file, suitable for use with dynamic pages, and can with parameters. Static include 码 码 码.............................. Assertion is a commonly used commissioning in software development, and this mechanism is supported in many development languages. In the implementation, Assertion is a statement in the program that checks a Boolean expression. A correct program must ensure that this Boolean expression is true; if the value is false, the program is already in an incorrect state. Next, the system will give a warning or exit. In general, Assertion is used to ensure the most basic and key correctness of the program. Assertion checks are usually opened when developed and tested. In order to improve performance, the assertion check is usually closed after the software is released. 24. What is GC? Why do you have GC? GC is the meaning of garbage collection, memory processing is where programmers are prone to problems, and forget or erroneous memory recovery will cause the program or system unstable or even crash. The GC function provided by Java can automatically monitor whether objects exceed the scope to reach the automatic recycling memory, and the Java language does not provide a display operation method that has been allocated.

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 calculation result is int Type, need forced conversion type) Short S1 = 1; S1 = 1; (can be correctly compiled) 26, Math.Round (11.5) is equal to how much? Math.Round (11.5) = = 12Math.Round (-11.5) == - 11Round method Returns the length of the parameters closest, the parameter plus 1/2 is followed by its floor.27, string s = new string ("xyz"); create a few String Object? Two 28, design 4 threads, two threads increase 1 each time two, and the other two threads are reduced each time. Write the program. The following procedure uses internal classes to implement threads, and no order issues are not considered when J is reduced. Public class threadtest1 {private int j; public static void main (string args []) {threadtest1 tt = new threadtest1 (); incin = tt.new inc (); 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 incmplements 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. Is there a reserved word in goto? Java, and now not use in Java. 30. Starting a thread is Run () or start ()? Starting a thread is to call the start () method so that the virtual processor represented by the thread is in operation, which means it can be scheduled and executed by the JVM. This doesn't mean that the thread will run immediately. The Run () method can generate a flag that must be exited to stop a thread.

31, EJB includes (sessionbean, entitybean) says their life cycle, and how to manage transactions? The lifecycle of the STASSIONBEAN: STATELESS session bean is determined by the container. When the client issues a request to establish a bean instance, the EJB container does not have to create a new bean instance for client call, but a place to find a present Some instances are provided to the client. When the client calls a stateful session bean for the first time, the container must immediately create a new bean instance in the server, and related to the client, after this client calls the Stateful session bean method, the container will assign the call to This client is associated with a bean instance. EntityBean: Entity Beans can survive relatively long time, and status is continuous. Entity Beans has always survive as long as the data in the database exists. Not in accordance with the application or service process. Even if the EJB container crashes, Entity Beans is also survived. The Entity Beans life cycle can be managed by the container or Beans. EJB is implemented by the following technical management practices: Object Management (OMG) Object Service (OTS), Sun Microsystems Transaction Service (JTS), Java Transaction API (JTA), Development Group (X / Open) XA interface. 32. What are the application servers? BEA WebLogic Server, IBM WebSphere Application Server, Oracle9i Application Server, JBoss, Tomcat33, gives me a Runtime Exception you most often seen. 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, UNSUPPORTEDOPERATIONEXCEPTION34, whether the interface can inherit the interface? Does the abstract class be implemented? Does the abstract class can inherit the physical class (Concrete Class)? The interface can inherit the interface.

转载请注明原文地址:https://www.9cbs.com/read-46918.html

New Post(0)