Java interview set

xiaoxiao2021-03-05  29

Basic knowledge:

1. Simple principle and application of exception handling mechanism in C or Java.

When the Java program violates the semantic rules of Java, the Java virtual machine will represent an error as an exception. Violation of semantic rules include 2 cases. One is a semantic check in the Java class library. For example, the array subscript can trigger indexoutofboundsexception; nullpointerException will be triggered when accessing null objects. Another situation is that Java allows programmers to extend this semantic check, and programmers can create their own exceptions and freely choose to trigger exceptions with throw keywords. All exceptions are

Java.lang.Thow Subclass.

2. The same and different sages of Java interfaces and C virtual classes.

Since Java does not support multi-inheritance, it is possible to use a class or object to use a method or attribute in several classes or objects, and existing single inheritance mechanisms cannot meet the requirements. Compared to inheritance, the interface has higher flexibility because there is no implementation code in the interface. When a class implements an interface, this class is to implement all methods and properties in the interface, and the properties in the interface are all public static below, all methods are public. Public. A class can implement multiple interfaces.

3. Advantages and principles of garbage collection. And consider 2 recycling mechanisms.

A significant feature in the Java language is to introduce the garbage collection mechanism, which makes the problem of the most headache of C programmers, making the Java programmers no longer need to consider memory management when writing programs. Since there is a garbage collection mechanism, the object in Java no longer has the concept of "scope", and only the reference to the object has a "scope". Garbage recycling can effectively prevent memory leaks, effective use of memory that can be used. The garbage collector is usually operated as a separate low-level thread. In the case of unpredictable objects that have been died or have not used for a long time for a long time for a long time, the programmer cannot call the garbage collector in real time. Object or all objects are garbage collection. The recycling mechanism has a replica collection of garbage collection and marking garbage recovery, incremental garbage recovery.

4. Please tell the thread synchronization you know.

Wait (): Make a thread in the waiting state and release the LOCK of the object held.

Sleep (): Make a running thread in sleep state, is a static method, call this method to capture InterruptedException exceptions.

NOTIFY (): Wake up a thread in a waiting state, note that when this method is called, it is not exactly the thread that is awakened, but is determined by the JVM which thread is awake, and is not pressed.

AllNotity (): Wake all threads in the waiting state, not to give all the locks of all awakening threads, but let them compete.

5. Please talk about the usage and function of the system and virtual functions.

6. What is the difference between ERROR and EXCEPTION?

Error indicates that the system level error and the exception do not have to be processed.

Exception indicates an exception that needs to be captured or needed.

7. A class in Java is declared as a final type, what does it mean?

It is said that the class cannot be inherited, it is a top class.

8. Describe your most common programming style.

9. What is the difference between HEAP and STACK.

The stack is a linear set, and the operation of adding and deleting elements should be completed in the same paragraph. The stack is processed in the way in which it is advanced.

Pile is a constituent element of the stack

10. If the system wants to use a large integer (more than the long range), you design a data structure to store this supermoder number and design a algorithm to implement a large integer addition operation).

Public class bigint ()

{

int [] arrone = new arrone [1000];

String IntString = ""; public int [] Arr (String S)

{

INTSTRING = S;

For (int i = 0; i

{

11. If you want to design a graphics system, you can design a simple implementation of basic graphics components (Point, Line, Rectangle, Triangle).

12. Talk about the difference between Final, Finally, Finalize.

Final-modifier (keyword) If a class is declared as Final, it means that it is no longer a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared as Abstract, and it is declared as final. Declaring variables or methods to Final, ensuring that they are not changed in use. Variables that are declared for final must give initial values ​​at the time of declaration, and only read in future references, cannot be modified. The method that is declared for Final is also available, and it is not overloaded.

Finally- provides a Finally block when processed. If you throw an exception, then the matching catch clause will execute, and then the control will enter the Finally block (if any).

Finalize-method name. Java technology allows the use of the Finalize () method to make the object to clear the object from the memory before making the necessary cleanup work. This method is called by the garbage collector when it is determined that this object is not referenced. It is defined in the Object class, so all classes have inherited it. Subclasses override the Finalize () method to organize system resources or perform other cleanup work. The Finalize () method is called by this object before the garbage collector deletes the object.

13, anonymous inner class (anonymous internal class) can be extends other classes, can IMPLEMENTS INTERFACE (interface)?

The anonymous internal class is an internal class without a name. You cannot extends other classes, but an internal class can be implemented as an interface, and is implemented by another internal class.

14. Static Nested Class and Inner Class are different, the more you say, the better (the interview is very general).

NESTED CLASS (generally C statement), Inner Class (typically Java said). The maximum difference between Java internal classes and C nested classes is whether there is a reference to the outside. Specific visible http://www.frontfree.net/articles/services/view.asp?id=704&page=1

Note: Static Inner Class means 1 creation of an object of a Static internal class, does not require an external class object, 2 cannot access an external class object from an object of a Static internal class

The difference between fourth, & and &&.

& Is a bit operator. && is the Boolean logic operator.

15, the difference between HashMap and HashTable.

Both of the MAP interface, implement the unique key to a specific value.

The HashMap class is not classified or sorted. It allows a NULL key and multiple NULL values.

Hashtable is similar to HashMap, but NULL keys and NULL values ​​are not allowed. It is also slower than HashMap because it is synchronized.

16, the difference between Collection and Collectes.

Collections is a class under java.util that contains a variety of static methods related to the collection.

Collection is an interface under java.util, which is a parent interface of a variety of collections. 17. When did you use Assert.

As an assertion, a statement containing Boolean expression, assuming that the expression is TRUE when this statement is executed. If the expression is calculated as false, then the system will report an AssertionError. It is used to debug purposes:

Assert (a> 0); // throws an assertionerror if a <= 0

There are two forms of assertions:

Assert Expression1;

Assert Expression1: Expression2;

Expression1 should always produce a Boolean value.

Expression2 can be any expression that draws a value. This value is used to generate a String message displaying more debugging information.

As default, it is disabled by default. To enable assertions while compiling, you need to use Source 1.4 tags:

Javac -Source 1.4 Test.java

To enable assertion at runtime, you can use the -enableassertions or the -ea tag.

To disable assertion at runtime, you can use the -DA or the -disableAssertions tag.

To enable assertion in the system class, you can use the -esa or -dsa tag. You can also enable or disable assertions on the basis of the package.

An assertion can be placed at any position that is not reached in normal conditions. As an assertation can be used to verify the parameters passing to the private method. However, assertions should not be used to verify parameters passing to the public method, as there is no matter whether it is enabled, the public method must check its parameters. However, it can be used in public methods or in a non-public method to use asserts to test the post condition. In addition, the assertion should not change the status of the program in any way.

18. What is GC? Why do you have a GC? (Foundation).

GC is a garbage collector. Java programmers don't have to worry about memory management because the garbage collector will automatically manage. To request garbage collection, you can call one of the following methods:

SYSTEM.GC ()

Runtime.getRuntime (). GC ()

19, string s = new string ("xyz"); created a few String Object?

Two objects, one is "XYX", one is a reference object S pointing to "XYX".

20, Math.Round (11.5) Is it equal to Math.Round (-11.5)?

Math.Round (11.5) Returns (long) 12, Math.Round (-11.5) Returns (long) -11;

21, Short S1 = 1; S1 = S1 1; What is wrong? SHORT S1 = 1; S1 = 1; What is wrong?

Short S1 = 1; S1 = S1 1; error, S1 is the short type, S1 1 is INT type, cannot explicitly convert to a SHORT type. Can be modified to S1 = (Short) (S1 1). Short S1 = 1; S1 = 1 is correct.

22. What is the difference between SLEEP () and WAIT ()?

The SLEEP () method is to stop the thread to stop a period of time. After the SLEEP time interval is full, the thread does not necessarily resume it immediately. This is because at that moment, other threads may be running and are not scheduled to give up execution, unless (a) "wake up" thread has higher priority (b) that is running because of other reasons.

Wait () is a thread interaction if the thread issues a wait () call, the thread is suspended, the object is adjusted to the waiting state until it is awake or waiting time. 23, have java goto?

The reserved word in Goto-Java is not used in Java.

24. Is there a length () method for arrays? String has a length () method?

The array does not have Length () method, with the properties of the length.

String has a length () method.

25, the difference between overload and Override. Can OVERLOADED methods change the type of return value?

The method of rewriting Overriding and overloading 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. The way OVERLOADED is to change the type of return value.

26, the elements in the set cannot be repeated. What method is used to distinguish whether it is repeated? Is it == or equals ()? What is the difference?

The elements in the set cannot be repeated, then use the iterator () method to distinguish whether you are repeated. Equals () is the judgment of whether two SETs are equal.

Equals () and == Method Decide whether the reference value points to the same object Equals () override in the class, which is the true value of the content and type of two separate objects.

27, give me a Runtime Exception you most often.

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

28. What is the difference between ERROR and EXCEPTION?

Error indicates a serious problem that recovery is not impossible but difficult. For example, memory is overflow. It is impossible to expect the program to handle this situation.

Exception represents a design or implementation problem. That is, it means that if the program runs normally, it will never occur. 29, List, SET, MAP inherits from a Collection interface?

List, SET is

MAP is not

30. What is the difference between Abstract Class and Interface?

The presence of a declaration method does not implement its class called abstract class, which is used to create a class that reflects certain basic behavior and declares the class, but cannot implement this class in this class. Case. An instance of the Abstract class cannot be created. However, you can create a variable, which is an abstract class and let it point to an instance of the specific subclass. There is no abstract constructor or abstract static method. Subclasses of the Abstract class provide implementation for all abstraction methods in their parent class, otherwise they are also abstract classes. Instead, this method is implemented in the subclass. Other classes that know their behavior can be implemented in the class.

Interface is a variant of an abstract class. In the interface, all methods are abstract. Multiple inheritance can be obtained by achieving such an interface. All methods in the interface are abstract, no probabilities. The interface can only define the Static Final member variable. The implementation of the interface is similar to the subclass, except that the implementation class cannot inherit behavior from the interface definition. When the class implements a special interface, it defines the method of all such an interface (that is, the program body is given). Then, it can call the interface to call the interface on any object of the class of the interface. Because there is an abstract class, it allows the interface name as the type of reference variable. The usual dynamic cable will take effect. The reference can be converted to an interface type or a slave interface type, and the InstanceOf operator can be used to determine whether an object is implemented.

31. Is Abstract's Method can be static at the same time, whether it is native at the same time, is it SYNCHRONIZED?

both are not

32. Is the interface to inherit the interface? Does the abstract class implement (IMPLEMENTS) interface? Does the abstract class can inherit the physical classes (Concrete Class)?

The interface can inherit the interface. Abstract classes can be implemented, whether abstract classes can inherit physical classes, but provided that the entity class must have a clear constructor.

33. Start a thread is Run () or start ()?

Starting a thread is to call the start () method so that the virtual process representing 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.

34. Is the constructor CONSTRUCTOR can be Override?

The constructor constructor cannot be inherited, so Overriding cannot be overridden, but Overloading can be overloaded.

35, can you inherit the String class?

The String class is that the final class cannot be inherited.

36. After a thread enters an SYNCHRONIZED method of an object, can other threads can enter this object?

No, a Synchronized method of an object can only be accessed by one thread.

37, Try {} has a return statement, then the code in finally {} after this try will not be executed, when is executed, before returnome or after?

Will be executed, execute before return.

38. Program: 2 multiplied 8 equal to a few with the most efficient method?

Programmers with C background especially like to ask this question.

2 << 3

39, the same value is the same (x.equals (y) == true, but there can be different haveh codes, this sentence is wrong? Is wrong, have the same havehing.

40. After an object is passed as a parameter to a method, this method can change the properties of this object and return the resulting result, then here is the value delivery or reference delivery?

It is a value transfer. The Java programming language is only passed by the value. When an object instance is transmitted to the method as a parameter, the value of the parameter is a reference to the object. The content of the object can be changed in the called method, but the reference to the object will never change.

41, whether SWTICH can act on Byte, whether it can act on Long, can it work on String?

Switch (expr1), expr1 is an integer expression. Therefore, the parameters passing to the Switch and the CASE statement should be int, short, char or byte. Long, String can not work on SWTICH.

42. Program: Write a Singleton.

The main role of the Singleton mode is to ensure that only one example exists in a Java application.

General Singleton mode usually has several forms:

The first form: Define a class, its constructor is private, it has a type of PRIVATE for a Static, an instantimeter of the class initialization, get a reference to it through a public GetInstance method, then call it Methods.

Public class singleton {

Private kindleton () {}

// Is it very strange to define an instance inside yourself?

// Note this is Private only for internal calls

Private static singleleton instance = new singleleton ();

/ / Here is a static method for accessing this Class, you can directly access

Public static singleleton getinstance () {

Return Instance;

}

}

The second form:

Public class singleton {

Private static singleton instance = null;

Public static synchronized singleton getInstance () {

// This method has been improved above, and it is only the first time.

// Generate an instance when using it, improve efficiency!

IF (instance == null)

Instance = new singleleton ();

Return Instance;}

}

Other forms:

Define a class, its constructor is private, all methods are static.

It is generally considered that the first form is more secure.

Hashtable and havehmap

HashTable inherits from the Dictionary class, and HashMap is an implementation of Map Interface introduced by Java1.2.

Hashmap allows null as a key or value of Entry, and hashtable is not allowed

Also, Hashmap removes the HashTable's Contains method, changed to ContainsValue and Containskey. Because the Contains method is easy to cause misunderstandings.

The biggest difference is that the HashTable method is SYNCHRONIZE, and Hashmap is not, when accessing the HashTable in multiple threads, does not need to be synchronized for its method, and hashmap

It is necessary to provide external synchronization.

Hash / rehash algorithms used by HashTable and Hashmap are probably, so performance will not have a big difference.

43. Describe the principle mechanism of JVM loading Class files?

44. Test example illustrates a typical garbage collection algorithm?

45. Use the Java to write the binary algorithm to achieve the addition of data to form a binary tree, and print it in a preface.

46. ​​Please write a Java program to implement the thread connection pool function?

47. Given a C language function, require implementation to call in the Java class.

48, editing a code, realizing after the console input a set of numbers, then exported after the console is output;

49, list all files under a folder;

50. The call system command implements the operation of deleting files;

51. Implementation of a character's operation from a file;

52, list some methods of controlling the process;

53, what are the states of multi-thread?

54. Writing a server-side program implementation is displayed on the client input character and displays on the console until "end" is entered, let you write the client's program;

55, scope public, private, protected, as well as when you write

A: The difference is as follows:

Scope current class with the same package children, other packages

PUBLIC √ √ √ √

Protected √ √ × ×

Friendly √ √ × ×

PRIVATE × × × ×

Do not write, default is Friendly

56, the difference between ArrayList and Vector, the difference between HashMap and HashTable

A: ARRAYLIST and VECTOR are mainly from two aspects.

I. Synchronization: Vector is a thread safe, that is to say is synchronized, and ArrayList is unsafe line programs, not synchronous.

II. Data growth: When you need to grow, Vector default growth is the original one, but ArrayList is half.

It is mainly from three aspects on Hashmap and HashTable.

I. Historical reasons: HashTable is an implementation of the MAP interface introduced by the Java 1.2 based on the old Dictionary class.

II. Synchronization: Hashtable is a thread safe, that is, HashMap is unsafe, not synchronous

Three. Values: Only HashMap allows you to take null values ​​as a key or value of a table

57. Can a Chinese Chinese character can be stored in the char type variable? Why?

A: It is possible to define a Chinese, because Java is encoded in Unicode, a char accounts for 16 bytes, so a Chinese is no problem.

58. There are several implementation methods. What is it? Synchronize several implementation methods, what is it?

A: Multi-thread has two implementation methods, which are inheriting the Thread class and implementing Runnable interface.

There are two implementations in synchronization, Synchronized, Wait and Notify, respectively.

59. How to optimize the garbage recovery mechanism?

I hope everyone will make up, thank you.

60, FLOAT FLOAT F = 3.4 is it correct?

A: Not correct. The accuracy is not accurate, and it should be converted with a mandatory type, as shown below: float f = (float) 3.4

61. Describe the Collection Framework in Java, including how to write your own data structure)?

A: The Collection Framework is as follows:

COLLECTION

├List

│├LINKEDLIST

│├ARRAYLIST

│ └Vector

│ └stack

└SET

Map

├Hashtable

├Hashmap

└weakhashmap

Collection is the most basic set interface, a collection represents a set of object, ie the elements of Collection (Elements)

Map provides mapping of Key to Value

62. Abnormal processing mechanism in Java, event mechanism?

11. Proffles and inheritance in Java?

I hope everyone will make up, thank you.

63, abstract class and interface?

A: Abstract class and interface are used for abstraction, but the abstract class (Java) can have its own partial implementation, and the interface is completely an identifier (both multiple inheritance functions).

Program:

1. Now enter n numbers, comma, separate;

You can then select liter or descending order;

Press the submit button to display on another page

What is sorted, the result is,

RESET

Answer (1) Public static string [] splitstringBycomma (string source) {

IF (source == null || Source.trim (). Equals (""))

Return NULL;

StringTokenizer Commatoker = New StringTokenizer (SOURCE, ",");

String [] result = new string [commatoker.countToKens ()];

INT i = 0;

While (Commatoker.hasmoreToKens ()) {

Result = commatoker.nextToken ();

i ;

}

Return Result;

}

Cycle traversal String array

Integer.Parseint (String S) becomes int type

Composition INT array

Arrays.sort (int [] a),

A array ascending

Descending order can start output from the tail

2. The amount conversion, the amount of the Arab figures are converted into Chinese traditional forms such as:

(¥ 1011) -> (1 thousand and 1 yuan) output.

3. Inheriting the order of execution of the class is generally a choice question, ask you how to print out?

A: Parent class:

Package test;

Public Class FatherClass

{

Public FatherClass ()

{

System.out.println ("FatherClass Create");

}

}

Subclass:

Package test;

Import Test.fatherClass;

Public Class ChildClass Extends FatherClass

{

Public ChildClass ()

{

System.out.println ("ChildClass Create");

}

Public static void main (string [] args)

{

Fatherclass fc = new fatherclass ();

Childclass cc = new childclass ();

}

}

Output results:

C:> Java Test.childclass

FatherClass Create

FatherClass Create

CHILDCLASS CREATE4, the implementation of internal classes?

A: The sample code is as follows:

Package test;

Public Class OuterClass

{

Private class interclass, PRIVATE CLASS Interclass

{

Public interclass ()

{

System.out.println ("Interclass Create");

}

}

Public outerclass ()

{

Interclass IC = New Interclass ();

System.out.println ("Outerclass Create");

}

Public static void main (string [] args)

{

Outerclass oc = new outerclass ();

}

}

Output result:

C:> Java Test / OuterClass

Interclass Create

OuterClass Create

Agather:

Public class outerclass {

Private Double D1 = 1.0;

// INSERT CODE Here

}

You NEED TO INSERT An Inner Class Declaration At Line 3. Which Two Inner Class Declarations Are

Valid? (choose two.)

A. Class innerone {

Public Static Double Methoda () {Return D1;}

}

B. Public class innerone {

Static Double Methoda () {Return D1;

}

C. private class innerone {

Double methoda () {Return D1;}

}

D. static class innerone {

protected double methoda () {return d1;}

}

E. Abstract class innerone {

Public Abstract Double Methoda ();

}

described as follows:

I. Static internal classes can have static members, not static internal classes, no static members. Therefore, A, b fault

II. Non-static members of static internal classes can access the external class of static variables, not accessible non-static variables; RETURN D1 error.

Dimension

III. Non-static members of non-static internal classes can access unstatic variables of external classes. Therefore, C is correct

IV. The answer is C, E

5, Java communication program, programming questions (or question and answer), programming, read servers, and write to local display with Java Socket

A: Server end program:

Package test;

Import

Java.net. *;

Import

Java.io. *;

Public Class Server

{

Private serversocket ss;

PRIVATE SOCKET Socket;

PRIVATE BUFFEREDREADER IN

Private PrintWriter Out;

Public server ()

{

Try

{

SS = New Serversocket (10000);

While (True)

{

Socket = ss.accept ();

String remoteip = socket.getinetaddress (); gethostaddress ();

String remoteport = ":" Socket.getlocalPort ();

System.out.println ("A Client Come In! IP:" Remoteip Remoteport); IN = New BufferedReader (New

InputStreamReader (socket.getinputstream ()));

String line = in.readline ();

System.out.println ("CLEINT Send IS:" line);

OUT = New PrintWriter (socket.getOutputStream (), true);

Out.println ("Your Message Received!");

Out.close ();

In.Close ();

Socket.close ();

}

} catch (ioException e)

{

Out.println ("WRONG");

}

}

Public static void main (string [] args)

{

New server ();

}

}

Client End Program:

Package test;

Import

Java.io. *;

Import

Java.net. *;

Public Class Client

{

Socket socket;

Bufferedreader in;

Printwriter out;

Public client ()

{

Try

{

System.out.println ("Try to Connect To 127.0.0.1:10000");

Socket = New Socket ("127.0.0.1", 10000);

System.out.println ("The Server Connected!");

System.out.Println ("please enter some character:");

BufferedReader line = new bufferedreader (New

InputStreamReader (System.in);

OUT = New PrintWriter (socket.getOutputStream (), true);

Out.println (line.readline ());

IN = New BufferedReader (socket.getinputStream ());

System.out.println (in.readline ());

Out.close ();

In.Close ();

Socket.close ();

} catch (ioException e)

{

Out.println ("WRONG");

}

}

Public static void main (string [] args)

{

NEW client ();

}

}

6. Use Java to achieve a method of ordering, Java classes to realize serialization (two)? As in the Collection framework, what kind of interface is to be achieved?

A: Sort by the insert method is as follows

Package test;

Import

Java.util. *;

Class insertsort

{

ArrayList Al;

Public InsertSort (int Num, int MOD)

{

Al = New ArrayList (NUM);

Random Rand = new random ();

System.out.println ("The arraylist sort before:");

For (int i = 0; i

Al.Add (new integer (math.abs (rand.nextint ())% mod 1));

System.out.println ("Al [" i "] =" Al.Get (i));

}

}

Public void sortit ()

{

Integer Tempint;

INT maxSize = 1;

For (INT I = 1; I

{

Tempint = (Integer) Al.Remove (i);

IF (Tempint.intValue ()> = (Integer) Al.Get (MaxSize-1)). INTVALUE ())

{

Al.Add (MaxSize, Tempint);

MaxSize ;

System.out.println (al.toString ());

} else {

For (int J = 0; j

{

IF

((Integer) Al.Get (j)). INTVALUE ()> = Tempint.intValue ())

{

Al.Add (j, tempint);

MaxSize ;

System.out.println (al.toString ());

Break;

}

}

}

}

System.out.println ("The ArrayList Sort After:");

For (int i = 0; i

{

System.out.println ("Al [" i "] =" Al.Get (i));

}

}

Public static void main (string [] args)

{

INSERTSORT IS = New Insertsort (10,100);

Is.sortit ();

}

}

The Java class realizes the methodification method is to implement java.io.serializable interface

Compare Compare Comparison in the Collection Framework To implement the Comparable interface and Comparator interface

7. Programming: Write a function that intercept strings, input as a string and byte, and outputs a string that is intercepted by byte. But to ensure that the Chinese characters are not taken, such as "I abc" 4, should be "I abc", enter "I am ABC Han DEF", 6, should output "I ABC" instead of "I am ABC Han ".

A: The code is as follows:

Package test;

Class splitstring

{

String splitstr;

Int splitbyte;

Public splitstring (String str, int Bytes)

{

Splitstr = STR;

Splitbyte = bytes;

System.out.println ("THE STRING IS: '" SPLITSTER "; splitbytes =" splitbyte);

}

Public void splitit ()

{

Int loopcount;

LoopCount = (splitstr.length ()% splitbyte == 0)? (splitstr.length () / splitbyte) :( splitstr.length () / split

BYTE 1);

System.out.println ("Will Split INTO" LoopCount; for (int i = 1; i <= loopcount; i )

{

IF (i == loopcount) {

System.out.println (Splitstr.Substring ((i-1) * splitbyte, splitstr.length ()));

} else {

System.out.println (Splitstr.Substring ((i-1) * splitbyte, (i * splitbyte))))))

}

}

}

Public static void main (string [] args)

{

Splitstring ss = new splitstring ("TEST DD Wen DSAF in Male Big 3443N China 43 Chinese

0EWLDFLS = 103 ", 4);

ss.splitit ();

}

}

8, Java multi-threaded programming. Write a multi-thread program with Java, such as writing four threads, two plus 1, two to one variable minus one, output.

I hope everyone will make up, thank you.

9, the difference between String and StringBuffer.

A: The length of String is invisible, and the length of StringBuffer is variable. If you use the content in the string, especially when you want to modify, use StringBuffer, if you finally need String, use StringBuffer's toString () method

JSP

1. What built-in objects have jsp? What is the role?

A: JSP has 9 basic built-in components (can correspond to six internal components of the ASP):

Request user request, this request will contain parameters from Get / POST request

Response web page back to the user's response

The properties of the PageContext page are managed here

Session and request related session

Application Servlet is being executed

OUT is used to transfer the output of the response

Config servlet architecture components

Page JSP page itself

Exception For error web, unconcerned exceptions

2, what actions are there? What is the role?

A: JSP has the following six basic actions

JSP: incrude: Introduces a file when the page is requested.

JSP: Usebean: Find or instantiate a JavaBean.

JSP: setProperty: Sets the properties of JavaBean.

JSP: getProperty: Outputs the properties of a JavaBean.

JSP: Forward: Turn the request to a new page.

JSP: Plugin: Generate Object or Embed tags based on the browser type to the Java plugin

3, Dynamic INCLUDE and Static Include in JSP?

Answer: Dynamic include use JSP: Include action implementation

It always checks the changes in the file included, suitable for use with dynamic pages, and can be used

Static Include is implemented with the include false code, which does not check the changes of the file included, suitable for the static page

<% at include file = "incruded Dot HTM"%>

4, what is the difference between the two jump methods? What is the difference?

A: There are two kinds, respectively:

The frontier page does not turn to the page referred to in INCLUDE, just display the result of the page, the main page is still the original page. It will come back later, which is equivalent to the function call. And can be used with parameters. The latter is completely turned to a new page and will not come back. Equivalent to the GO TO statement.

Servlet

1, talk about the life cycle of servlet?

A: Servlet has a good definition of survival, including loading and instantiation, initialization, processing request, and service end. This survival period is expressed by the init, service, and destroy method of the javax.servlet.servlet interface.

2, the SERVLET version (forgot what two versions are asked)?

I hope everyone will make up, thank you.

3, the difference between forward () and redirect () in the Java Servlet API?

A: The former is only the steering of the control of control in the container. It does not show the turn-behind address in the client browser address bar; the latter is completely jump, the browser will get the address of the jump, and re-re- Send a request link. Thus, the link address after the jump is seen from the address bar of the browser. Therefore, the former is more efficient, and when the former can meet the needs, try to use the forward () method, and this also helps to hide the actual link. In some cases, for example, you need to jump into a resource on a further server, you must use the sendRedirect () method.

4, the basic architecture of servlet

Public class servletname extends httpservlet {

Public Void Dopost (httpservletRequest Request, HttpservletResponse Response) THROWS

ServletException, IOException {

}

Public void doget (httpservletRequest Request, HttpservletResponse Response) THROWS

ServletException, IOException {

}

}

JDBC, JDO

1, you may let you write a JDBC even Oracle program and implement data queries.

A: The program is as follows:

Package hello.ant;

Import

Java.sql. *;

Public Class JDBC

{

String dburl = "JDBC: Oracle: Thin: AT 127 Dot 0.0.1: 1521: ORCL";

String theuser = "admin";

String thepw = "manager";

Connection C = NULL;

STATEMENT CONN;

ResultSet RS = NULL;

Public JDBC ()

{

Try {

Class.Forname ("Oracle.jdbc.driver.OracleDriver"). NewInstance ();

C = DriverManager.getConnection (dburl, theuser, thepw);

CONN = C.CREATESTATEMENT ();

} catch (exception e) {

E.PrintStackTrace ();

}

}

Public Boolean ExecuteUpdate (STRING SQL)

{

Try

{

CONN.EXECUTEUPDATE (SQL); Return True;

}

Catch (SQLException E)

{

E.PrintStackTrace ();

Return False;

}

}

Public ResultSet ExecuteQuery (String SQL)

{

RS = NULL;

Try

{

Rs = conn.executeQuery (SQL);

}

Catch (SQLException E)

{

E.PrintStackTrace ();

}

Return RS;

}

Public void close ()

{

Try

{

CONN.CLOSE ();

C. close ();

}

Catch (Exception E)

{

E.PrintStackTrace ();

}

}

Public static void main (string [] args)

{

ResultSet RS;

JDBC conn = new JDBC ();

RS = conn.executeQuery ("Select * from test");

Try {

While (rs.next ())

{

System.out.println (rs.getstring ("id"));

System.out.println (rs.getstring ("name");

}

} catch (Exception E)

{

E.PrintStackTrace ();

}

}

}

2, Class.Forname role? Why is it used?

A: Call this access to return an object that is specified by a string specified class name.

3, what is JDO?

A: JDO is a new specification for Java object persistence, which is a referred to as Java Data Object, and is also a standardized API for accessing objects in a data warehouse. JDO provides transparent object storage, so that the developer does not require additional code (such as the JDBC API). These cumbersome routines have been transferred to the JDO product provider, so that developers are freed out to concentrate on time and energy logically. In addition, JDO is flexible because it can run on any data underlayer. JDBC is just more common to relational database (RDBMS) JDO, providing storage capabilities of any data underlying, such as relational database, file, xml, and object database (ODBMS), etc., make it stronger to apply portability.

4. Subject solution in Oracle's large amount of data. Generally, the ID method is used, and there is a three-layer nested method.

A: A paging method

<%

INT i = 1;

INT NUMPAGES = 14;

String pages = Request.getParameter ("Page");

INT CurrentPage = 1;

CurrentPage = (Pages == NULL)? (1): {Integer.Parseint (PAGES)}

SQL = "SELECT Count (*) from Tables";

ResultSet RS = DBLINK.EXECUTEQUERY (SQL);

While (rs.next ()) i = rs.getinT (1);

INT INTPAGECUNT = 1;

INTPAGECOUNT = (I% Numpages == 0)? (i / numpages): (I / Numpages 1);

Int nextpage;

INT.

NextPage = CURRENTPAGE 1;

IF (Next> = INTPAGECOUNT) NextPage = INTPAGECOUNT;

UPPAGE = CURRENTPAGE-1;

IF (UPPAGE <= 1) UPPAGE = 1;

Rs.close ();

SQL = "SELECT * from Tables";

Rs = dblink.executequery (SQL);

i = 0;

While ((i

%>

// Output content

/ / Output page connection

Total: <% = currentpage%> / <% = INTPAGECOUNT%> first page

HREF = "list.jsp? Page = <% = UPPAGE%>"> Previous

<%

For (int J = 1; j <= INTPAGECOUNT; J ) {

IF (CurrentPage! = J) {

%>

Next last page

XML aspect

1, what parsing technology is there? Is there anything?

A: There are DOM, SAX, Stax, etc.

DOM: It is very powerful when processing large files. This problem is caused by the tree structure of the DOM. This structure is more memory, and the DOM must load the entire document into memory before parsing the file, suitable for the random access of XML SAX: not now in Dom, SAX is Event drive type XML parsing method. It sequentially reads the XML file, and does not need to load all files all. When encountered at the beginning of the file, the end of the document, or the label is ended, it triggers an event, and the user handles the XML file by writing processing code in its callback event, suitable for the order of XML.

Stax: streaming API for XML (stax)

2. What are your aspects of XML technology in the project? How to implement it?

A: Data storage, information configuration is two aspects. When doing a data exchange platform, the data that cannot be data sources cannot be assembled into an XML file, and then the XML file is compressed and encrypted, and then transmitted to the recipient through the network, and the decryption is decryled and decompressed and the related information is reduced in the XML file. When doing software configuration, it is easy to use XML, and the various configuration parameters of the software are stored in the XML file.

3. How to solve Chinese problems when using JDOM to resolve the Chinese problem? How to resolve?

A: Look at the following code, solve the encoding method

Package test;

Import

Java.io. *;

Public Class Domtest

{

Private string infile = "c: /people.xml";

Private string Outfile = "c: /people.xml";

Public static void main (string args []) {

New domtest ();

}

Public domtest ()

{

Try

{

Javax.xml.parsers.documentbuilder builder =

Javax.xml.Parsers.DocumentBuilderFactory.newInstance (). NewDocumentBuilder ();

Org.w3c.dom.document doc = builder.newdocument ();

Org.w3c.dom.Element root = doc.createElement ("teacher");

Org.w3c.dom.Element Wang = Doc.createElement ("King");

Org.w3c.dom.Element Liu = Doc.createElement ("Liu");

Wang.Appendchild (Doc.createTextNode ("I am Teacher"))

Root.appendchild (wang);

Doc.Appendchild (root);

Javax.xml.transform.transformer Transformer =

Javax.xml.transform.transformerfactory.newinstance (). NewTransformer ();

TRANSFORMER.SETOUTPUTPROPERTY (javax.xml.transform.outputkeys.encoding, "gb2312");

Transformer.setputProperty (javax.xml.transform.outputkeys.indent, "yes");

Transformer.Transform (New Javax.xml.Transform.dom.Domsource (DOC),

New

Javax.xml.transform.Stream.StreamResult (outfile));

}

Catch (Exception E)

{

System.out.println (E.getMessage ());

}

}

}

4. Programming Way to parse XML in Java.

A: The XML file is analyzed by SAX, the XML file is as follows:

Wang Xiaoming

Information College

6258113

Male, born in 1955, Ph.D., marked in Hainan University in 95 years

Event callback class saxhandler.java

Import

Java.io. *;

Import

Java.util.hashtable;

Import org.xml.sax. *;

Public Class SaxHandler Extends Handlerbase

{

Private hashtable table = new hashtable ();

Private string currentelement = null;

PRIVATE STRING CURRENTVALUE = NULL;

Public void settable (HashTable Table)

{

THIS.TABLE = TABLE;

}

Public hashtable gettable () {

Return Table;

}

Public void StartElement (String Tag, AttributeList Attrs)

Throws SAXEXCEPTION

{

Currentelement = tag;

}

Public void characters (char [] ch, int start, int ingth)

Throws SAXEXCEPTION

{

CurrentValue = New String (CH, Start, Length);

}

Public void endelement (String name) THROWS SAXEXCEPTION

{

Currentelement.equals (name))

Table.Put (Currentelement, CurrentValue);

}

}

JSP content displays source code, SAXXML.JSP:

Analysis XML file people.xml </ title></p> <p></ HEAD></p> <p><Body></p> <p><% at page errorpage = "Errpage Dot JSP"</p> <p>ContentType = "text / html; charSet = GB2312"%></p> <p><% at page import = "java dot io. *"%></p> <p><% at page import = "java dot util.hashtable"%></p> <p><% at page import = "ORG DOT W3C.DOM. *"%></p> <p><% at page import = "org Dot Xml.sax. *"%></p> <p><% at page import = "javax dot xml.parsers.saxparserfactory"%></p> <p><% at page import = "javax dot xml.parsers.saxparser"%></p> <p><% at page import = "saxhandler"%></p> <p><%</p> <p>File File = New File ("C: / People Dot XML");</p> <p>FileReader Reader = New FileReader (file);</p> <p>Parser Parser;</p> <p>SAXPARSERFACTORY SPF = saxparserfactory.newinstance ();</p> <p>SAXPARSER SP = SPF.NEWSAXPARSER ();</p> <p>SAXHANDLER HANDLER = New SAXHANDLER ();</p> <p>Sp.Pars (New InputSource (Reader), Handler;</p> <p>Hashtable hashtable = handler.gettable ();</p> <p>Out.println ("<Table Border = 2> <Caption> Teacher Information Table </ CAPTION>");</p> <p>Out.println ("<tr> <td> Name </ td>" "<TD>" </p> <p>(String) HashTable.Get (New String ("Name")) "</ td> </ tr>"); out.println ("<tr> <td> college </ td>" "<TD> " </p> <p>(String) HashTable.get (New String ("College")) "</ td> </ tr>");</p> <p>Out.println ("<tr> <td> phone </ td> " <td> " </p> <p>(String) HashTable.Get (New String ("Telephone")) "</ TD> </ TR>");</p> <p>Out.println ("<tr> <TD> Remarks </ TD>" "<TD>" </p> <p>(String) HashTable.Get (New String ("Notes") "</ TD> </ TR>");</p> <p>Out.println ("</ Table>");</p> <p>%></p> <p></ Body></p> <p></ Html></p> <p>EJB aspect</p> <p>1. What are the contents of EJB2.0? What are the differences in EJB2.0 and EJB1.1?</p> <p>A: The specification includes the Bean provider, the application assembly, EJB container, EJB configuration tool, EJB service provider, system administrator. In this regard, the EJB container is the core of EJB. The EJB container manages EJB creation, undo, activation, deactivation, and the database connection, etc. Important work. JSP, Servlet, EJB, JNDI, JDBC, JMS .....</p> <p>2, the difference between EJB and Java Bean?</p> <p>A: Java bean is a reused component, which 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</p> <p>Java beans are equivalent to DCOM, namely 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.</p> <p>3, EJB basic architecture</p> <p>A: An EJB includes three parts:</p> <p>Remote Interface interface code</p> <p>Package beans;</p> <p>Import javax.ejb.ejbobject;</p> <p>Import</p> <p>Java.rmi.RemoteException;</p> <p>Public Interface Add Extends EJBOBJECT</p> <p>{</p> <p>// Some method Declare}</p> <p>HOME Interface interface code</p> <p>Package beans;</p> <p>Import</p> <p>Java.rmi.RemoteException;</p> <p>Import jaax.ejb.createException;</p> <p>Import javax.ejb.ejbhome;</p> <p>Public Interface AddHome Extends EJBHOME</p> <p>{</p> <p>// Some Method Declare</p> <p>}</p> <p>EJB class code</p> <p>Package beans;</p> <p>Import</p> <p>Java.rmi.RemoteException;</p> <p>Import javax.ejb.sessionbean;</p> <p>Import javx.ejb.sessionContext;</p> <p>Public Class Addbean Implements SessionBean</p> <p>{</p> <p>// Some Method Declare</p> <p>}</p> <p>J2EE, MVC</p> <p>1, all parts of MVC have those technologies to achieve? How to implement?</p> <p>A: MVC is a short written by Model-View-Controller. "Model" is the application's business logic (implemented by javabean, ejb component), "view" is the application's representation surface (generated by JSP page), "Controller" is a process control (generally a servlet) The application logic, processing procedure, and display logic are achieved by this design model into different components. These components can interact and reuse.</p> <p>2, the difference between application servers and web server?</p> <p>I hope everyone will make up, thank you.</p> <p>3, what is J2EE?</p> <p>A: JE22 is a multi-dimi-Diered, distributed, distributed, component-based, based on Component-Base, in which an application system can follow Function is divided into different components that can be on different computers and are in the corresponding hierarchy (TIER). The hierarchies are included in the ClientN Tier components, web layers, and components, Business layers, and components, and corporate information systems (EIS) layers.</p> <p>4. Web service noun explanation. JSWDL development package. JAXP, JAXM explanation. SOAP, UDDI, WSDL Explanation.</p> <p>A: Web Service Description Language WSDL</p> <p>SOAP is a Simple Object Access Protocol, which is a lightweight protocol used to exchange XML encoded information.</p> <p>The purpose of UDDI is to establish standards for e-commerce; UDDI is a web-based, distributed, implementation standard specification provided by the information registry for Web Service, and also includes a group of web services that can provide themselves. Register to achieve the implementation of the access protocols that other companies can discover.</p> <p>5, links and differences between BS and CS.</p> <p>I hope everyone will make up, thank you.</p> <p>6, Struts application (such as Struts architecture)</p> <p>A: Struts is a Framework that uses Java Servlet / JavaServer Pages technology to develop web applications. The Struts can develop an application architecture based on MODEL-View-Controller design mode. Struts has the following main features:</p> <p>I. Contains a Controller Servlet that can send the user's request to the corresponding Action object.</p> <p>II.Jsp Free Tag Library and provide association support in the Controller Servlet to help developers create interactive form applications.</p> <p>3. Provide a series of practical objects: XML processing, automatically handle JavaBeans properties, international tips and messages through Java Reflection APIs. Design mode</p> <p>1. Use the design mode in the development? What are the occasions?</p> <p>A: Each mode describes a question in our environment and then describes the core of the solution. In this way, you can use the existing solutions countlessly without counting the same job. Mainly used in the design pattern of MVC. Used to develop JSP / Servlet or J2EE related applications. Simple factory model, etc.</p> <p>2, UML</p> <p>A: Standard modeling language UML. Model example, static map (including class diagram, object map, and package), behavioral map, interaction map (sequential diagram, cooperation map), implementation diagram,</p> <p>JavaScript</p> <p>1. How do I verify digital?</p> <p>VAR RE = / ^ D {1,8} $ | .d {1, 2} $ /;</p> <p>Var str = document.form1.all (i) .value;</p> <p>Var r = str.match (re);</p> <p>IF (r == null)</p> <p>{</p> <p>SIGN = -4;</p> <p>Break;</p> <p>}</p> <p>Else {</p> <p>Document.form1.all (i) .value = parsefloat (STR);</p> <p>}</p> <p>CORBA</p> <p>1. What is CORBA? What is the use?</p> <p>A: The CORBA standard is a common object request agency structure, which is standardized by the object management organization (Object Management Group, abbreviated as OMG). Its composition is the interface definition language (IDL), language binding (binding: also translated into a cable) and an agreement to interoperate interoperability. Its purpose is:</p> <p>Written in different programming languages</p> <p>Run in different processes</p> <p>Development of different operating systems</p> <p>Linux</p> <p>1, Linux underline, explanation of the GDI class.</p> <p>A: Linux implementation is based on the "one-to-one" thread model of the core lightweight process, and a thread entity corresponds to a core lightweight process, and the management between the thread is implemented in the nuclear external function library.</p> <p>The GDI class is an image device programming interface class library.</p> <p>Java Huawei Interview</p> <p>Java aspect</p> <p>1 What are the object-oriented characteristics?</p> <p>2 STRING is the most basic data type?</p> <p>3 INT and Integer What is the difference?</p> <p>4 String and StringBuffer difference</p> <p>5 What is the difference between abnormality at runtime?</p> <p>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.</p> <p>6 Speak some common class, package, interface, please give 5</p> <p>7 Say the storage performance and feature of ArrayList, Vector, LinkedList</p> <p>All ArrayList and Vector are stored in an array. This array element is larger than the actual stored data to increase and insert an element, which allows direct sequence index elements, but inserts an element to involve memory operation such as array elements, so index data Fast and inserted, Vector due to the use of the Synchronized method (thread security), usually more arraylist, and LinkedList uses two-way linked lists to store, and sequence index data needs to be forwarded or rearward, but inserting data only You need to record the front and rear items of this item, so the insert is faster.</p> <p>8 Design 4 threads, two threads increase 1 each time, and two threads are reduced each time. Write the program.</p> <p>The following procedure uses internal classes to implement threads, and no order issues are not considered when J is reduced.</p> <p>Public class threadtest1 {private int j;</p> <p>Public static void main (string args []) {</p> <p>Threadtest1 TT = New Threadtest1 ();</p> <p>INC = TT.NEW INC ();</p> <p>Dec dec = tt.new dec ();</p> <p>For (int i = 0; i <2; i ) {</p> <p>Thread T = New Thread (INC);</p> <p>T.Start ();</p> <p>T = New Thread (DEC);</p> <p>T.Start ();</p> <p>}</p> <p>}</p> <p>Private synchronized void inc () {</p> <p>J ;</p> <p>System.out.println (thread.currentthread (). GetName () "- inc:" J);</p> <p>}</p> <p>Private synchronized void dec () {</p> <p>J -;</p> <p>System.out.println (thread.currentthread (). GetName () "- DEC:" J);</p> <p>}</p> <p>Class incblements runnable {</p> <p>Public void run () {</p> <p>For (int i = 0; i <100; i ) {</p> <p>INC ();</p> <p>}</p> <p>}</p> <p>}</p> <p>Class Dec Implements Runnable {</p> <p>Public void run () {</p> <p>For (int i = 0; i <100; i ) {</p> <p>DEC ();</p> <p>}</p> <p>}</p> <p>}</p> <p>}</p> <p>9. The built-in object and method of JSP.</p> <p>Request Request represents the HTTPServletRequest object. It contains information about the browser request and provides a number of methods for obtaining cookie, header, and session data.</p> <p>Response response represents the HTTPServletResponse object and provides several methods for setting the response to the browser (such as cookies, header information, etc.)</p> <p>Out out object is an instance of javax.jsp.jspwriter, and provides several ways to make you use to return output results to your browser.</p> <p>PageContext PageContext represents a javax.servlet.jsp.pageContext object. It is an API for convenient access to various range spaces, servlet-related objects, and wraps a generic Servlet related feature.</p> <p>Session session represents a request Javax.Servlet.http.httpsession object. SESSION can store the status information of the user</p> <p>Application Applicat Indicates a Javax.Servle.ServletContext object. This helps find information about the Servlet engine and the servlet environment</p> <p>Config config represents a javax.servlet.ServletConfig object. This object is used to access the initialization parameters of the servlet instance.</p> <p>Page Page Represents a servlet instance from this page</p> <p>10. Written communication with the Socket communication requests the customer to return the same data after sending the data.</p> <p>See the Socket Communication in the course.</p> <p>11 Say the life cycle of the servlet and say the difference between servlet and CGI.</p> <p>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.</p> <p>12.EJB is based on which technologies are implemented? And say the difference between SessionBean and EntityBean, the differences of Statefulbean and STATELESSBEAN.</p> <p>13. EJB includes (sessionbean, entitybean) says their life cycle, how to manage transactions?</p> <p>14. What is the working mechanism of the data connection pool?</p> <p>15 Synchronous and asynchronous and asynchronous, use them in what circumstances? for example.</p> <p>16 What are the application servers?</p> <p>17 What are your collections you know? Main method?</p> <p>18 Give you: Driver A, Data Source Name B, the user name is C, the password is D, the database table is T. All the data of the table T is retrieved with JDBC.</p> <p>19. Say how to make a pagination in the JSP page?</p> <p>The page needs to be saved the following parameters:</p> <p>Total number of lines: According to the SQL statement, the total number of banks</p> <p>Variety of lines per page: set value</p> <p>Current page: request parameters</p> <p>The page calculates the number of rows of the current page according to the number of current pages and the number of rows per page, and the positioning result is set to this line, and the result set takes out the number of rows of rows per page.</p> <p>Database:</p> <p>1. Difference of stored procedures and functions</p> <p>The stored procedure is a collection of user-defined series of SQL statements, involving tasks for specific tables or other objects, and users can call stored procedures, and function is usually the method defined by the database, which receives parameters and returns a certain type of value and not Recommended specific user tables.</p> <p>2. What is the transaction?</p> <p>The transaction is a series of operations performed as a logical unit, and a logical work unit must have four properties, called ACID (atomic, consistency, isolation and persistence) attributes, only this can become a transaction:</p> <p>Atomicity</p> <p>The transaction must be an atomic work unit; for its data modification, it is either executed, or all do not execute.</p> <p>consistency</p> <p>When the transaction is completed, you must keep all the data consistently. In the relevant database, all rules must be used to modify the transaction to maintain all data integrity. At the end of the transaction, all internal data structures (such as B tree indexes or bidirectional linies) must be correct.</p> <p>Isolation</p> <p>The modifications made by concurrent affairs must be isolated from any other concurrent business. Transaction View the status of data when data is displayed, or another concurrent transaction modifies its previous state, or another transaction modifies the state after it, the transaction does not view the data of the intermediate state. This is referred to as serialization because it can reload the starting data and replay a series of transactions so that the status at the end of the data is the same as the original transaction.</p> <p>Persistence</p> <p>After the completion of the transaction, its impact on the system is permanent. This modification will remain maintained even if there is a system failure.</p> <p>3. The role of the cursor? How do you know that the cursor has arrived at the end?</p> <p>The cursor is used to position the result set. By determining the global variable AT @Fetch_status can determine whether the final increase, this variable is usually equal to 0 to indicate an error or finally. 4 DOT triggers are divided into existing triggers and afterwards, these two triggers have and difference. What is the difference between statement level trigger and row trigger.</p> <p>The prior trigger is running before the trigger event occurs, and after the event is running after the trigger event occurs. Usually the prior trigger can get the event before and the new field value.</p> <p>Statement-level triggers can be executed before or after execution of statements, while the row triggers each row that triggered in the trigger.</p> <p>Come and farm test</p> <p>1, three basic characteristics of object-oriented</p> <p>2, the concept and difference of method overload and method rewriting</p> <p>3, interface and internal class, the characteristics of abstract classes</p> <p>4. Basic class read and write</p> <p>** 5, serialization precautions and how to implement serialization</p> <p>6, the basic concept of thread, the basic state of the thread and the relationship between state</p> <p>7, the synchronization of threads, how to implement the synchronization of threads</p> <p>8, several common data structures and internal implementation principles.</p> <p>9, Socket Communication (TCP, UDP Differences, Java Implementation)</p> <p>** 10, Java's event entrustment mechanism and garbage collection mechanism</p> <p>11. Basic steps for JDBC calling the database</p> <p>** 12, parse several ways and differences in XML files</p> <p>13. Definition of four basic permissions of Java</p> <p>14, Java Internationalization</p> <p>Second, JSP</p> <p>1, at least you can say that 7 implied objects and their differences</p> <p>** 2, the difference between Forward and Redirect</p> <p>3, JSP common instructions</p> <p>Third, servlet</p> <p>1, call doget () and dopost () under what circumstances?</p> <p>2, the intervilet's init () method and service () method difference</p> <p>3, the life cycle of servlet</p> <p>4, how to real real servlet single-thread mode</p> <p>5, servlet configuration</p> <p>6, four session tracking technology</p> <p>Four, EJB</p> <p>** 1, EJB container provided by the EJB container</p> <p>It mainly provides services such as declaration cycle management, code generation, continuous management, security, transaction management, lock and distribution management.</p> <p>2, EJB role and three objects</p> <p>EJB roles mainly include Bean Developers Application Assembarer Deployer System Administrator EJB Container Provider EJB Server Provider</p> <p>Three objects are Remote (local) interface, home (localhome) interface, Bean class</p> <p>2, several types of EJB</p> <p>Session Bean, entity (Entity) bean message driver (Message Driven) bean</p> <p>Session bean can be divided into stateful and stateless</p> <p>Entity Beans can be divided into two kinds of sustainability (BMP) and container management of bean management (CMP)</p> <p>3, life cycle of the bean instance</p> <p>For Stateless Session Bean, Entity Bean, Message Driven Bean typically exists in cache management, which typically contains Cache management, set up the context, create EJB Object (create), business method call, remove, etc. Procedure, for the bean in which the buffer is managed, the instance is not removed from memory, but the buffer pool scheduling mechanism continues to reuse the instance, and the bean in which Cache Management is used, the BEAN is maintained by activating and deactivating the mechanism. Limit the number of instances in memory.</p> <p>4, activation mechanism</p> <p>Take the Statefull Session Bean as an example: The Cache size determines the number of bean instances that can exist in memory, according to the MRU or NRU algorithm, instance migrate between activation and deactivation, activation mechanism is when the client calls an EJB When an instance business method, if the corresponding EJB Object discovers that it does not bind the corresponding bean instance, the reactive bean storage (by serializing mechanism storage instance) is replied (activated) this instance. The corresponding EJBACTIVE and EJBPASSIVATE methods are called before the state change. 5, the main role of the Remote interface and HOME interface</p> <p>The REMOTE interface defines a business method for the EJB client calling business method.</p> <p>The HOME interface is an EJB factory for creating and removing a lookup EJB instance</p> <p>6. Several basic steps for customer service end calling EJB objects</p> <p>First, set the JNDI service factory and JNDI service address system properties</p> <p>Second, find home interface</p> <p>Third, call the CREATE method from the home interface to create a Remote interface</p> <p>Fourth, call its business method through the Remote interface</p> <p>V. Database</p> <p>1. Writing of the stored procedure</p> <p>2. Basic SQL statement</p> <p>Sixth, WebLogic</p> <p>1. How to specify the size of the memory to WebLogic?</p> <p>In the Script of WebLogic (bitservername in the Domian corresponding server directory), add SET MEM_ARGS = -XMS32M -XMX200M, adjust the minimum memory to 32M, maximum 200M</p> <p>2, how to set the hot start mode (development mode) of WebLogic and product release mode?</p> <p>The startup mode of the corresponding server can be modified in the management console is one of the development or product modes. Or modify the service startup file or Comufact of the Commenv file, add set production_mode = true.</p> <p>3, do you need to enter your username and password when starting?</p> <p>Modify the service launch file, add WLS_USER and WLS_PW items. You can also add an encrypted username and password in the boot.properties file.</p> <p>4. After the WebLogic Management Table is configured for a application domain (or a website, Domain) for JMS and EJB or connection pool, and what file is actually saved?</p> <p>Save in the config.xml file of this Domain, it is the core profile of the server.</p> <p>5. Talk about the default directory structure of a Domain in WebLogic? For example, put a simple helloWorld.jsp into the point of directory, but you can enter on your browser.</p> <p>Http: // Host: port number // ... ¯ to see the running result? What should I do if I use a JavaBean written by it?</p> <p>Domain Directory / Server Directory / Applications, place the application directory in this directory will be available as an application access. If it is a web application, the application directory needs to meet the web application directory requirements, the JSP file can be placed directly in the application directory, Javabean needs to be put In the CLASSES directory for the application directory, the default application that sets the server will be able to implement the application name on your browser.</p> <p>6, how do I view EJBs already released in WebLogic?</p> <p>You can use the management console, you can view all published EJBs in its deployment</p> <p>7, how to make SSL configurations in WebLogic and the client's authentication configuration or talk about J2EE (standard) for SSL configuration</p> <p>Using DemoIdentity.jks and Demotrust.jks KeyStore in the default installation, you need to configure the server to use Enable SSL, configure its port, you need to get private key and digital certificate from CA in product mode, create Identity and Trust KeyStore, load get Keys and digital certificates. You can configure this SSL connection to one-way or two-way.</p> <p>8. Publishing EJB in WebLogic needs to involve which profiles of different types of EJBs are different, all involved configuration files include ejb-jar.xml, weblogic-ejb-jar.xmlcmp entity beans generally need WebLogic- CMP-RDBMS-JAR.XML</p> <p>9, EJB needs to implement its business interface or home interface, please briefly describe the reasons.</p> <p>The remote interface and home interface do not need to be directly implemented, and their implementation code is generated by the server, and the implementation class in the program run is used as an instance of the corresponding interface type.</p> <p>10. Talk about the difference between Persistent and Non-Persisten when developing message beans in WebLogic</p> <p>The MDB of the Persistent method ensures the reliability of the message delivery, that is, if the EJB container has problems, the JMS server will send the message when this MDB can be used, and the Non-Persistent method will be discarded.</p> <p>11. Talk about several common modes in J2EE you are familiar with or have heard? And some views on design patterns</p> <p>Session Facade Pattern: Accessing EntityBean using sessionbean</p> <p>Message Facade Pattern: Realization asynchronous call</p> <p>EJB Command Pattern: Use Command JavaBeans to replace sessionBean to achieve lightweight access</p> <p>Data Transfer Object Factory: Simplify EntityBean Data Provision for DTO Factory</p> <p>Generic Attribute Access: Simplify EntityBean Data Provision for EntityBeaN</p> <p>Business Interface: Realize the same interface to specify business logic through remote (local) interface and bean classes</p> <p>The design of the EJB architecture will directly affect the performance, scalability, maintenanceability, components reusability and development efficiency. The more complicated the project, the brighter the project team, the more important it can reflect the importance of good design.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-32842.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="32842" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.053</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'XOTG2WD_2B4h7i5CUm9XI_2BgIg9_2BzWFVrtcMtYNyYPELf401jkewG76gkFCq2m3tm8nGP6JOMhqdMgxOKz_2FbkWdMg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>