J2EE Foundation Concept

xiaoxiao2021-03-06  93

Java foundation:

1, scope public, protected, private, as well as the difference

2, the difference between ArrayList and Vector, the difference between Hashmap and HashTable

3, can the char type variable can be defined as a Chinese? Why?

4, many threads have several representations, what is it? Synchronize several implementation methods, what is it?

5. Inheriting the order of execution of the class is generally a choice question, ask you what will print out?

6, the internal class implementation?

7. How to optimize the garbage recovery mechanism?

8, FLOAT FLOAT F = 3.4 is it correct?

JSP

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

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

3, the difference between the two implementations of INCLUDE?

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

Servlet

1, talk about the life cycle of servlet?

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

JDBC, JDO

1, you may let you write a JDBC even Oracle program.

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

3, what is JDO?

XML aspect

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

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

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

EJB aspect

1. What are the contents of EJB2.0? What are the differences in EJB2.0 and EJB1.1?

MVC aspect

1, all parts of MVC have those technologies to achieve? How to implement?

Design mode:

1. Use the design mode in the development? What are the occasions?

JavaScript

1. How do I verify digital?

Corba

1. What is CORBA? What is the use?

Who will make an answer! -------------------------------------------------- ----------- Answer part. 1. Scope public, protected, private, and non-written distinguishes PUBLIC in other packages can also be referenced, protected is limited to classes in the same package, private can only be used by themselves. When you don't write, you are like protected. 2. The difference between ArrayList and Vector, the difference between HashMap and HashTable ArrayList needs to pre-define the size, and Vector is not. The default initialization capacity of HashMap and HashTable Different HashMap is 16, and hashtable is 11.3. Can CHAR type variables can be defined as a Chinese? Why? Can definition. Because Chinese is also 16bit. 4, there are several representations of multi-thread, what is it? Synchronize several implementation methods, what is it? View the JDK document. 5. Inherited the order of execution, generally a choice question, ask you what will print? This specific look. 6. Internal class implementation? Internal class "is a class in another class. From Java 1.1, you can declare another class in a class, which is very similar to the declaration field and method. 7, garbage Recycling mechanism, how to optimize the program? When the variable is not used, it is null.8, whether the float type float f = 3.4 is correct? No. Type does not match. Change to float f = 3.4f.

Servlet

1. Say the lifecycle of the servlet? Servlet lifecycle is when the server loads servlets, receives multiple requests from the client and returns the data to the client, and then delete the time of removing servlets. 2, the servlet version (forgot to ask which two versions of the question)? I personally think that there is no practical meaning of this problem. JDBC, JDO

1, you may let you write a JDBC even Oracle program. Volume. Connection conn = null; string driver = "Oracle.jdbc.driver.OracleDriver"; string url = "jdbc: oracle: thin: @xxx: 1521: xxx"; string user = "xxx"; string password = "xxx"; try {Class.forName ( "oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection (url, user, password);} catch (ClassNotFoundException e) {System.err.print ( "ClassNotFoundException: Load jdbc-driver Failure! "); System.err.Println (E.GetMessage ());} catch (sqlexception e) {E.PrintStackTrace (); try {ix! = null) {conn.close (); conn = null }}}} Catch (SQLException SE) {}} 2, the role of Class.Forname? Why is it used? Returns a Class object that specifies the name. Use it to be a class that you specify name for loading. 3, what is JDO? Full name Java Data Objects. Provide significant persistence of the Java object model in the transaction database, directly supporting an instance of the Java class, and the application does not have to process any other data model. XML aspect

1, XML What is the analysis technology? What is the difference? 1) CSS is the abbreviation of the cascading style sheet, "laminated style sheet", which issued the first standard CSS1 in the style list while issuing HTML4 standard in 1997. .2) XSL (Extensible style language, scalable style language) is the most powerful and flexible style language, which is especially designed to apply XML, which fully follows the XML rules, further improving the XML itself. 3) Data-island. There are also a few, but mainly the second, the other I think it is not mainstream. 2. What are your aspects of XML technology in the project? How to achieve XSLT, FO, HTML parsing, XML data package and parsing. Implement with a third-party software package. 3. How to solve Chinese problems when using JDOM to resolve the Chinese problem? How to analyze? Nothing, not clear. I am using the Castor. (There is JBuilder9)

JavaScript

1. How to verify digital? Isnan (Parsefloat (xxx)) If true, it is not a number. --- Do your ability and supplement: (1) Vector method is synchronized, is thread-safe, and ArrayList's method is not, due to the synchronization of threads inevitably affect performance, therefore, ArrayList's performance is better than Vector. (2) When the element in Vector or ArrayList exceeds its initial size, Vector doubles its capacity, and ArrayList only increases the size of 50%, so ArrayList is conducive to saving memory space. (3) HashTable is an implementation of the MAP interface introduced by the Java 1.2 based on the old Dictionary class. (4) Performance is more similar to Vector and ArrayList, such as HashTable methods are synchronized, while HashMap is not. (5) Only HashMap allows you to take null values ​​as a key or value of the entry of a table - 1, what is the analysis of what is the difference? There are two types: DOM and SAX.

DOM: You can get a tree structure containing all elements in the document. SAX: An event can be generated in the document, and the application can determine how to handle these events to get information from the parser. --- Java foundation :( Not Writing is already an existing answer or I am not known or uncertainty)

4, many threads have several representations, what is it? There are several implementation methods in synchronization. What is it?: I have two implementation methods: one is to synchronize the method: public synchronized methodname. ..) {....} The other is to synchronize the object (this object cannot be a null value): synchronized (object) {.....}

5. Inheriting the order of execution of the class is generally a choice question, ask you how to print? Inherited time the execution order is: the part defined by the Static keyword is the most defined in the parent class. First initialized; parent class constructor (in the order of call);

The part defined by the STATIC keyword is first initialized by the STATIC keyword; the subclass constructor (in the call sequence); other call sequence according to the method.

6, internal class implementation? Public class xxxxx {// only one public class

... class yyyyy {// can have access type is [protected | private | None] ...}

}

8, Float type float f = 3.4 is it correct? I don't know if it is correct. I usually: float f = 3.4f; or float f = 3.4f; // follow with an English uppercase or lowercase letter f --- JavaScript

1. How to verify the digital model? Var v = document.all.telephone.value; if (ISNAN (V)) {Alert ("all numbers");} --- yangtaylor explains more than half of the error, Don't make a standard answer back. Noisysilence is very good, indicating that you are already a master, but you explain that the exquisite setting of Vector is the setting of the second parameter, the rest is basically correct.

About "Scheme PUBLIC, PROTECTED, PRIVATE, and Differences in Different" --- The top three are common, don't say, I will explain about the situation when I don't write: Java's role domain has 5 In addition to the three of the above: private protected, defaultpublic -------------- Do not say protected ----------- In addition to all subclasses Outside the visit, the non-subclass of the same bag can also access Private ------------- does not say private protected - only subclasses can be accessed (this is Protected in our understanding " DEFAULT ------------- Only the class of the same bag can be accessed, even the subclasses but different packages still can't access me, I also read a lot of reference books, which is dedicated to this Everyone. --- ARRAYLIST and VECTOR differences have been said above, I talk about it will bring it. The same is the object collection, and the ArrayList can check by the compiler and the vector is not, so if you return to the object with a vector, the compiler is unable to check, and can only be found when running. For example: ******** Using Vector ************ Server Side: Public Vector GetCustomDataSet (INT NUM) {Vector V = New Vector (); for (int i = 0 i

******** Adopt arraylist *********************** Server Side: publicustomData [] getCustomData [] CustomData = new customData [5]; for (int); for i = 0; i

--- The bottom is the difference between HashTable and Hashmap I found.

There are three important differences between HashTable and HashmaphashTable and HashMap. The first difference is mainly historical reasons. Hashtable is an implementation of the Old Dictionary class, HashMap is an implementation of the MAP interface introduced by Java 1.2. Perhaps the most important difference is that the HashTable method is synchronized, while the HashMap method is not. This means that although you can use any special behavior to use a HashTable in a multi-threaded application, but you have to provide an external synchronization for a HashMap. A convenient method is to use the Static SynchronizedMap () method of the Collections class, which creates a thread secure MAP object and returns it as a package object. The method of this object allows you to synchronize the potential HashMap. The result of this is that when you don't need to synchronize, you can't cut off the synchronization in HashTable (such as in a single-threaded application), and synchronize has added a lot of processing costs. The third point is different, only HashMap allows you to take null values ​​as the key or value of the entry of a table. There is only one record in HashMap, which can be an empty key, but any number of entries can be empty Value. That is to say, if there is no search button in the table, or if the search button is found, it is an empty value, then get () will return NULL. If necessary, use the ContaInKey () method to distinguish these two situations. Some information suggestions when you need to synchronize, use HashTable, which is used to use HashMap. However, because when needed, HashMap can be synchronized, the HashMap's function is more than the HashTable function, and it is not based on an old class, so some people think that in all cases, Hashmap is preferred in HashTable. --- XML ​​programming interface: DOM SAX JDOM JAXP Document Object Model (commonly referred to as DOM) defines a set of interfaces for XML documents. The parser reads the entire document and builds a tree structure that resides in memory, then your code can use the DOM interface to operate this tree structure. You can traverse the tree to understand what is included, you can delete a few parts of the tree, you can rearrange the tree and add a new branch DOM to provide a set of rich features, you can use these features to explain and operate XML Document, but use them. Dom builds the entire document resides in memory. If the document is large, it will require great memory. DOM creates objects that represent each thing in the original document, including elements, text, properties, and spaces. If you only need to pay attention to a small part of the original document, create those objects that never use are extremely wasteful. The DOM parser must read the entire document before your code gets control. For very large documents, this will cause significant delay

To solve the DOM problem, XML-DEV participants (leadership by David Megginson) created SAX interfaces. Several features of SAX solve the problem of DOM:

The SAX parser sends an event to your code. When the parser finds the elements, the element is ended, the text, the beginning or end of the document, will tell you. You can decide what event is important to you, and you can decide what type of data structure to create to save data from these events. If you do not explicitly save data from an event, it is discarded. The SAX parser does not create any object at all, it just passes the event to your application. If you want to create an object based on those events, this will be done by you. The SAX parser starts sending events when parsing. When the parser discovers the document, the element starts and text, etc., the code will receive an event. Your app can start generating results immediately; you don't have to wait until the entire document is parsed. Sometimes, if you only find some of the content in the document, once you find what you want to find, you can throw an exception. This exception will stop the SAX parser, then the code does anything it needs to do with the data it finds. SAX parsers are also aimed at attention: SAX events are stateless. When the SAX parser found text in the XML document, it sends an event to your code. This event only gives you the text discovered; it doesn't tell you what element contains that text. If you want to know this, you must write your status management code yourself. SAX events are not lasting. If the application requires a data structure to model the XML document, you must write that code yourself. If you need to access the data from the SAX event, you have to store the data in the code, then you have to resolve the document again.

JDOM is an open source project based on Java technology. It tries to follow 80/20 rules: with DOM and SAX 20% function to meet 80% user needs. JDOM uses SAX and DOM parsers, so it is implemented as a relatively small Java class.

The main feature of JDOM is that it greatly reduces the number of codes you must write. Although this introductory tutorial does not discuss programming themes, the length of the JDOM application is usually one-third of the DOM application, approximately half of the SAX application. (Of course, insist on using the pure hiist of DOM recommends: From the long run, learn and use the DOM to return to the return). Jdom doesn't do everything, but for most of the resolution you want to do, it may just fit you.

Although DOM, SAX and JDOM provide standard interfaces for most common tasks, there are still some things that they cannot solve. For example, the process of creating a Domparser object in a Java program is different due to the DOM parser. To correct this problem, Sun released JAXP (Java API, Java API for XML Parsing) for XML parsing. The API provides a common interface for using the DOM, SAX and XSLT processing XML documents.

JAXP provides a standard interface for interfaces such as DocumentBuilderFactory and DocumentBuilder and DocumentBuilder. There are also methods that allow you to control whether the underlying parser can identify namespaces and whether to use DTD or mode to verify the XML document. To determine which interface is suitable for you, you need to understand the design points of all interfaces, and what you need to understand what the application will do with the XML document you want to process. Considering the following questions will help you find the right way.

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

New Post(0)