Java written test one

Source: Internet
Author: User
Tags bitwise xml parser websphere application server

Java-related Basics
2. Is string the most basic data type?
The basic data types are byte, int, char, long, float, double, Boolean, and short.
The Java.lang.String class is of the final type, so you cannot inherit the class or modify the class. In order to improve efficiency and save space, we should use the StringBuffer class
3. What is the difference between int and Integer
int is the raw data type of Java, and integer is the wrapper class provided by Java for Int.
4. The difference between String and StringBuffer
The Java platform provides two classes: string and StringBuffer, which can store and manipulate strings, which are character data that contain multiple characters. This string class provides a string of values that cannot be changed. The string provided by this StringBuffer class is modified. You can use StringBuffer when you know that character data is going to change. Typically, you can use Stringbuffers to dynamically construct character data.
5. What are the similarities and differences between abnormal operation and general anomaly?
An exception represents an unhealthy state that may occur during a program's run, and a run-time exception that represents an exception that may be encountered in a typical operation of a virtual machine is a common run error. The Java compiler requires the method to declare a non-runtime exception that might occur, but does not require that a runtime exception that is not caught to be thrown must be declared.
6. Speak the life cycle of the servlet and tell the difference between servlet and CGI.
When the servlet is instantiated by the server, the container runs its Init method, the service method is run when the request arrives, and the service method automatically dispatches the Doxxx method (Doget,dopost) corresponding to the request, etc. The Destroy method is called when the server decides to destroy the instance.
The difference from CGI is that the servlet is in a server process, it runs its service method in a multithreaded manner, one instance can serve multiple requests, and its instances are generally not destroyed, and CGI generates a new process for each request, which is destroyed after the service is completed. So the efficiency is lower than the servlet.
7, say Arraylist,vector, LinkedList storage performance and characteristics
Both ArrayList and vectors use arrays to store data, which is larger than the actual stored data in order to add and insert elements, both of which allow the element to be indexed directly by ordinal, but the insertion element involves memory operations such as array element movement, so the index data is fast and the data is inserted slowly. Vector because of the use of the Synchronized method (thread-safe), usually performance is worse than ArrayList, and LinkedList using a doubly linked list for storage, index data by ordinal need to be forward or backward traversal, but when inserting data only need to record the item before and after items can be , so the insertion speed is faster.
8. What technology is EJB based on? And say the difference between Sessionbean and Entitybean, Statefulbean and Statelessbean.
EJB includes session bean, Entity Bean, Message driven bean, which is implemented based on Jndi, RMI, Jat and so on.
Sessionbean is used in the Java EE application to perform some server-side business operations, such as accessing the database and invoking other EJB components. Entitybean is used to represent the data used in the application system.
For a client, Sessionbean is a non-persistent object that implements some business logic that runs on the server.
For a client, Entitybean is a persistent object that represents an object view of an entity stored in persistent storage, or an entity implemented by an existing enterprise application.
Session Bean can also be subdivided into Stateful session Bean and stateless session bean, both of which can put system logic in the method of execution, the difference is Stateful The session bean can record the status of the caller, so usually a user will have a corresponding entity for the Stateful Session Bean. Although the stateless session Bean is also a logical component, he is not responsible for recording the user state, which means that when the user calls the stateless Session bean, the EJB Container does not look for a specific stateless Ses Sion the Bean's entity to execute this method. In other words, it is likely that several users will be executing the Instance of the same bean when executing the methods of a stateless Session bean. In terms of memory, the Stateful session bean compared to the stateless session Bean, Stateful session bean consumes more memory from the Java EE Server, but Stateful Sessio The advantage of n beans is that he can maintain the user's state.
9. The difference between Collection and collections.
Collection is the ancestor interface of the collection class, and the main interface for inheriting it is set and list.
Collections is a helper class for a collection class that provides a series of static methods for searching, sorting, threading, and so on for various collections.
10, the difference between & and &&.
& is a bitwise operator that represents the bitwise AND Operation,&& is a logical operator that represents the logical and (and).
11. The difference between HashMap and Hashtable.
HashMap is a lightweight implementation of Hashtable (non-thread-safe implementation), they all complete the map interface, the main difference is that the HASHMAP allows null (NULL) key value (key), because of non-thread security, the efficiency may be higher than Hashtable.
HashMap allows NULL to be used as a entry key or value, and Hashtable is not allowed.
HashMap hashtable contains method removed, changed to Containsvalue and ContainsKey. Because the contains method is easy to cause misunderstanding.
Hashtable inherits from the dictionary class, and HashMap is an implementation of the map interface introduced by Java1.2.
The biggest difference is that the Hashtable method is synchronize, and HashMap is not, when multiple threads access Hashtable, they do not need to synchronize their methods, and HashMap must provide external synchronization.
The Hash/rehash algorithms used by Hashtable and HashMap are probably the same, so there is no big difference in performance.
12, final, finally, finalize the difference.
Final is used to declare properties, methods, and classes, respectively, that the property is immutable, that the method is not overridden, and that the class is not inheritable.
Finally is part of the exception-handling statement structure, which indicates that it is always executed.
Finalize is a method of the object class that, when executed by the garbage collector, calls this method of the reclaimed object, and can override this method to provide garbage collection of other resource recycles, such as closing the file.
13. What is the difference between sleep () and wait ()?
Sleep is a threading class (thread) method that causes this thread to pause execution for a specified time, giving the execution opportunity to other threads, but the monitoring state remains and is automatically restored when it is finished. Calling sleep does not release the object lock.
Wait is a method of the object class that calls the wait method on this object to cause this thread to discard the object lock, enter the waiting lock pool waiting for this object, and only after the Notify method (or Notifyall) is issued for this object the thread enters the object lock pool ready to get the object lock into the running state.
14, the difference between overload and override. Can the overloaded method change the type of the return value?
The overridden overriding and overloaded overloading of a method are different manifestations of Java polymorphism. Overriding overriding is a representation of polymorphism between a parent class and a subclass, and overloading overloading is a representation of polymorphism in a class. If you define a method in a subclass that has the same name and arguments as its parent class, we say that the method is overridden (overriding). When an object of a subclass uses this method, the definition in the subclass is called, and for it the definition in the parent class is "masked". If more than one method with the same name is defined in a class, they either have a different number of arguments or have different parameter types, which is called a method overload (overloading). The overloaded method is to change the type of the return value.
15. What is the difference between error and exception?
Error indicates a serious problem in situations where recovery is not impossible but difficult. For example, memory overflow. It is impossible to expect the program to handle such situations.
Exception represents a design or implementation issue. That is, it means that if the program runs normally, it never happens.
16. What are the similarities and differences between synchronous and asynchronous, and under what circumstances are they used separately? An example is described.
If the data will be shared between threads. For example, the data being written may be read by another thread later, or the data being read may have been written by another thread, then the data is shared and must be accessed synchronously.
When an application calls a method that takes a long time to execute on an object and does not want the program to wait for the method to be returned, it should use asynchronous programming, which is often more efficient in many cases with asynchronous approaches.
17. What is the difference between abstract class and interface?
A class that declares the existence of a method and does not implement it is called an abstract class, which is used to create a class that embodies some basic behavior, declares a method for that class, but does not implement the class in that class. An instance of the abstract class cannot be created. However, you can create a variable whose type is an abstract class that points to an instance of a specific subclass. Cannot have abstract constructors or abstract static methods. The subclasses of the abstract class provide implementations for all abstract methods in their parent class, otherwise they are also abstract classes. Instead, implement the method in the subclass. Other classes that know their behavior can implement these methods in the class.
An interface (interface) is a variant of an abstract class. In an interface, all methods are abstract. Multiple inheritance can be obtained by implementing such an interface. All the methods in the interface are abstract, without a program body. An interface can only define static final member variables. The implementation of an interface is similar to a subclass, except that the implementation class cannot inherit the behavior from the interface definition. When a class implements a special interface, it defines the method (which is given by the program body) to all such interfaces. It can then invoke the interface's method on any object that implements the interface's class. Because of an abstract class, it allows you to use the interface name as the type of the reference variable. The usual dynamic binder will take effect. A reference can be converted to an interface type or converted from an interface type, and the instanceof operator can be used to determine whether the class of an object implements an interface.
18. What is the difference between heap and stack?
A stack is a linear collection whose actions to add and delete elements should be completed in the same paragraph. The stack is processed in a last-in, first-out manner.
A heap is a constituent element of a stack
19. The difference between forward and redirect
Forward is the server requests the resource, the server directly accesses the URL of the destination address, reads the response content of that URL, and then sends the content to the browser, the browser does not know where the server sends the content from, so its address bar is the original address.
Redirect is the server based on logic, send a status code, tell the browser to request the address again, in general, the browser will use all the parameters just requested again, so the session,request parameters can be obtained.
20. What is the difference between EJB and Java bean?
Java beans are reusable components, and there is no strict specification for Java beans, and in theory, any Java class can be a Bean. In general, however, because Java beans are created by containers (such as Tomcat), Java beans should have a parameterless constructor, and in addition, Java beans typically implement the serializable interface to implement Bean persistence. Java beans are actually equivalent to the local in-process COM component in the Microsoft COM model, which cannot be accessed across processes. Enterprise Java beans are equivalent to DCOM, which is distributed components. It is a Java-based remote method invocation (RMI) technology, so EJBS can be accessed remotely (across processes, across computers). However, EJBS must be in containers such as Webspere, WebLogic, and EJB clients never directly access real EJB components, but are accessed through their containers. The EJB container is the proxy for the EJB component, and the EJB component is created and managed by the container. The customer accesses the real EJB component through the container.
21, Static Nested class and Inner class are different.
The static Nested class is an inner class declared static (static), which can be instantiated without relying on an external class instance. The usual inner classes need to be instantiated after the external class is instanced.
22. What is the difference between dynamic include and static include in JSP?
Dynamic include uses Jsp:include action to implement <jsp:include page= "included.jsp" flush= "true"/> It always checks for changes in the included files, is suitable for containing dynamic pages, and can take parameters.
Static include is implemented with the include pseudo-code and will not check for changes in the included files, and is suitable for containing static pages <%@ include file= "included.htm"%>
23, when to use the Assert.
Assertion (assertion) is a common debugging method in software development, which is supported in many development languages. In the implementation, assertion is a statement in the program, which checks a Boolean expression, a correct program must ensure that the value of the Boolean expression is true, if the value is False, the program is already in an incorrect state, The system will give a warning or exit. In general, assertion is used to ensure the most basic and critical correctness of the program. Assertion inspection is usually turned on during development and testing. To improve performance, the assertion check is usually turned off after the software is released.
24. What is GC? Why do you have a GC?
GC is the meaning of garbage collection (garbage Collection), memory processing is where programmers are prone to problems, forgetting or wrong memory recycling can cause program or system instability or even crashes, The GC functionality provided by Java can automatically monitor whether an object exceeds the scope to achieve the purpose of automatically reclaiming memory, and the Java language does not provide a way to release the displayed operation of the allocated memory.
25, short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?
Short S1 = 1; S1 = s1 + 1; (S1+1 operation result is int type, need cast type)
Short S1 = 1; S1 + = 1; (can be compiled correctly)
26, Math.Round (11.5) how much? Math.Round (-11.5) how much?
Math.Round (11.5) ==12
Math.Round (-11.5) ==-11
The round method returns the longest integer closest to the parameter, and the parameter adds 1/2 to its floor.
27, String s = new string ("XYZ"; a few string Object created?)
Two
28, Design 4 threads, of which two threads add 1 to J each time, and two threads to J for each reduction of 1 per second. Write the program.
The following program implements threads using an internal class, and does not consider order issues when adding or subtracting J.
public class threadtest1{
private int J;
public static void Main (String args[]) {
ThreadTest1 tt=new ThreadTest1 ();
Inc Inc=tt.new Inc ();
Dec dec=tt.new Dec ();
for (int i=0;i<2;i++) {
Thread T=new Thread (inc);
T.start ();
T=new Thread (DEC);
T.start ();
}
}
Private synchronized Void Inc () {
j + +;
System.out.println (Thread.CurrentThread (). GetName () + "-inc:" +j);
}
private synchronized void Dec () {
j--;
System.out.println (Thread.CurrentThread (). GetName () + "-dec:" +j);
}
Class INC implements runnable{
public void Run () {
for (int i=0;i<100;i++) {
Inc ();
}
}
}
Class Dec implements runnable{
public void Run () {
for (int i=0;i<100;i++) {
Dec ();
}
}
}
}
29. Does Java have goto?
Reserved words in Java are not currently used in Java.
30. Start a thread with run () or start ()?
Starting a thread is calling the start () method so that the virtual processor represented by the thread is in a running state, which means it can be dispatched and executed by the JVM. This does not mean that the thread will run immediately. The run () method can produce a flag that must be exited to stop a thread.


31, EJB includes (Sessionbean,entitybean) say their life cycle, and how to manage the transaction?
The lifecycle of the sessionbean:stateless Session Bean is determined by the container, and when the client makes a request to establish an instance of the bean, the EJB container does not have to create a new instance of the bean for the client to invoke. Instead, find an existing instance to provide to the client. When a client invokes a stateful session bean for the first time, the container must immediately create a new bean instance in the server and associate it with the client, which in the future calls the stateful session bean method, the container assigns the call to the bean instance associated with the client.
Entitybean:entity beans can survive for a relatively long time, and the state is persistent. As long as the data in the database exists, Entity beans has survived. Not according to the application or service process. Even if the EJB container crashes, the Entity beans is alive. The Entity beans life cycle can be managed by the container or beans itself.
EJB is managed by the following technologies: Object Management Organization (OMG), Transaction Service (JTS), Java Transaction API (JTA), Development Group (x/), Microsystems Services (OTS) Open) of the XA interface.
32. What are the application servers?
BEA WebLogic SERVER,IBM WebSphere application server,oracle9i application Server,jboss,tomcat
33, give me one of your most common to the runtime exception.
ArithmeticException, Arraystoreexception, Bufferoverflowexception, Bufferunderflowexception, CannotRedoException, Cannotundoexception, ClassCastException, Cmmexception, Concurrentmodificationexception, DOMException, Emptystackexception, IllegalArgumentException, Illegalmonitorstateexception, Illegalpathstateexception, IllegalStateException, Imagingopexception, Indexoutofboundsexception, MissingResourceException, Negativearraysizeexception, Nosuchelementexception, NullPointerException, Profiledataexception, ProviderException, Rasterformatexception, SecurityException, SystemException, Undeclaredthrowableexception, UnmodifiableSetException, Unsupportedoperationexception
34, interface can inherit interface? is an abstract class achievable (implements) interface? Does an abstract class inherit entity classes (concrete Class)?
Interfaces can inherit interfaces. Abstract classes can implement (implements) interfaces, whether an abstract class can inherit an entity class, but only if the entity class must have an explicit constructor.
35, List, Set, map inherit from collection interface?
List,set Yes, map is not
36. What is the working mechanism of the data connection pool?
The Java EE server starts with a certain number of pooled connections and maintains not less than this number of pooled connections. When a client program needs to connect, the pool driver returns an unused pooled connection and memento it as busy. If there is currently no idle connection, the pool driver creates a new number of connections, and the number of new connections is determined by the configuration parameters. When a pooled connection call is completed, the pool driver memento the connection to idle, and other calls can use the connection.
37, the abstract method can be static at the same time, whether it can be native at the same time, whether it can be synchronized at the same time?
Are not
38. Does the array have the length () method? Does string have the length () method?
The array does not have the length () method, which has the length property. String has the length () method.
39, set of elements can not be repeated, then what method to distinguish the repetition or not? Are you using = = or equals ()? What is the difference between them?
The elements in the set cannot be duplicated, so use the iterator () method to distinguish between duplicates or not. Equals () is the interpretation of two sets for equality.
The Equals () and = = methods Determine whether the reference value points to the same object Equals () is overwritten in the class so that when the contents and types of the two detached objects match, the truth is returned.
40. Can the constructor constructor be override?
The constructor constructor cannot be inherited, so overriding cannot be overridden, but can be overloaded with overloading.
41. Can I inherit the String class?
The string class is the final class and cannot be inherited.
42, whether the Swtich can function on a byte, whether it can function on a long, whether it can function on a string?
Switch (EXPR1), expr1 is an integer expression. So the arguments passed to the switch and case statements should be int, short, char, or byte. Long,string can not act on Swtich.
43. There is a return statement in try {}, then the code in the finally {} immediately after this try will not be executed, when executed, before or after the return?
Executes before the return.
44, programming problems: the most efficient way to calculate 2 times 8 and so on?
2 << 3
45, two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence right?
No, there's the same hash code.
46, when an object is passed as a parameter to a method, this method can change the properties of the object, and can return the changed results, then this is the value of the pass or reference pass?
is a value pass. The Java programming language has only value-passing parameters. When an object instance is passed as a parameter to a method, the value of the parameter is a reference to the object. The contents of the object can be changed in the called method, but the object's reference is never changed.
47. When a thread enters an synchronized method of an object, does the other thread have access to other methods of this object?
No, an synchronized method of an object can only be accessed by one thread.
48, Programming Problem: Write a singleton out.
The main purpose of the singleton mode is to ensure that only one instance of a class is present in a Java application.
The general singleton pattern usually has several forms:
The first form: Defines a class whose constructor is private, and it has a static private class variable that, when the class is initialized, gets a reference to it through a public getinstance method, and then calls the method in it.
public class Singleton {
Private Singleton () {}
Is it strange to define an instance of yourself within yourself?
Note that this is private only for internal calls
private static Singleton instance = new Singleton ();
This provides a static method for external access to this class, which can be accessed directly
public static Singleton getinstance () {
return instance;
}
}
The second form of:
public class Singleton {
private static Singleton instance = NULL;
public static synchronized Singleton getinstance () {
This method is better than the above, and does not have to be generated every time, just the first time
Generate an instance when used, improve the efficiency!
if (instance==null)
Instance=new Singleton ();
return instance; }
}
Other forms:
Defines a class whose constructor is private, and all methods are static.
The first form is generally considered to be more secure.
49, Java interface and C + + virtual class of the same and different places.
Because Java does not support multiple inheritance, it is possible for a class or object to use a method or property that is within several classes or objects, and the existing single-inheritance mechanism cannot satisfy the requirement. The interface has more flexibility than inheritance because there is no implementation code in the interface. When a class implements an interface, the class implements all the methods and properties inside the interface, and the properties inside the interface are public static under the default state, and all methods are public by default. A class can implement multiple interfaces.
50. The simple principle and application of exception handling mechanism in Java.
When a Java program violates the semantics of Java rules, the Java virtual machine will represent the error that occurred as an exception. There are 2 cases of violating semantic rules. One is the semantic check built into the Java class library. For example, array subscript is out of bounds, indexoutofboundsexception is thrown, and NullPointerException is thrown when a null object is accessed. Another scenario is that Java allows programmers to extend this semantic check, and programmers can create their own exceptions and freely choose when to throw exceptions with the throw keyword. All exceptions are subclasses of java.lang.Thowable.
51, the advantages and principles of garbage collection. and consider 2 kinds of recycling mechanisms.
A notable feature of the Java language is the introduction of a garbage collection mechanism, which makes it possible for the C + + programmer to solve the most troublesome memory management problems, which makes it unnecessary for Java programmers to consider memory management when writing programs. Because there is a garbage collection mechanism, objects in Java no longer have a "scope" concept, and only references to objects are scoped. Garbage collection can effectively prevent memory leaks and effectively use memory that can be used. The garbage collector is typically run as a separate low-level thread, unpredictable and clear and recyclable for objects that have died in the heap or that have not been used for a long time, and the programmer cannot call the garbage collector in real time for garbage collection of an object or all objects. The recycling mechanism has generational replication garbage collection and token garbage collection, incremental garbage collection.
52. Please say the thread synchronization method you know.
Wait (): causes a thread to be in a wait state and releases the lock of the object it holds.
Sleep (): Makes a running thread sleep, is a static method that calls this method to catch the interruptedexception exception.
Notify (): Wakes up a waiting thread, noting that when this method is called, it does not actually wake up a waiting state thread, but is determined by the JVM to wake up which thread, and not by priority.
Allnotity (): Wakes all the threads that are in the waiting state, noting that they do not give all the wake-up threads an object lock, but instead let them compete.
53. What are the collection classes you know? The Main method?
The most common collection classes are List and Map. The specific implementation of the list includes ArrayList and vectors, which are variable-sized lists that are more appropriate for building, storing, and manipulating any type of object. List is useful for cases where elements are accessed by numeric indexes.
MAP provides a more general method of storing elements. The Map collection class is used to store element pairs (called "Keys" and "values"), where each key is mapped to a value.
54. Describe the principle mechanism of the JVM loading class file?
The loading of classes in the JVM is implemented by ClassLoader and its subclasses, and Java ClassLoader is an important Java Runtime system component. It is responsible for locating and loading classes of class files at run time.
55. Can I store a Chinese character in char type?
Can be defined as a Chinese, because in Java encoding in Unicode, a char accounted for 16 bytes, so put a Chinese is no problem
56, multi-threaded there are several ways to achieve, what is it? How are there several implementations of synchronization?
There are two ways to implement multithreading, namely, inheriting the thread class and implementing the Runnable interface.
There are two implementations of synchronization, namely Synchronized,wait and notify
57, JSP's built-in objects and methods.
The request represents the HttpServletRequest object. It contains information about the browser request and provides several useful ways to get the cookie, header, and session data.
Response represents the HttpServletResponse object and provides several methods for setting the response to the browser (such as cookies, header information, etc.)
The Out object is an instance of Javax.jsp.JspWriter and provides several methods that you can use to echo the output to the browser.
PageContext represents a Javax.servlet.jsp.PageContext object. It is an API for easy access to a wide range of namespaces, servlet-related objects, and a way to wrap generic servlet-related functionality.
The session represents a requested Javax.servlet.http.HttpSession object. Session can store the user's status information
Applicaton represents a Javax.servle.ServletContext object. This helps to find information about the servlet engine and the servlet environment
Config represents a Javax.servlet.ServletConfig object. This object is used to access the initialization parameters of the servlet instance.
Page represents a servlet instance that is generated from this page
58. Basic concepts of threads, the basic state of threads, and the relationship between states
A thread is an execution unit that executes a program's code during the execution of a program, and each program has at least one thread, the program itself.
There are four types of threads in Java: Run, ready, suspend, end.
59. Common directives of JSP
<% @page language= "java" contentype= "text/html;charset=gb2312" session= "true" buffer= "64KB" autoflush= "true" Isthreadsafe= "true" info= "text" errorpage= "error.jsp" iserrorpage= "true" iselignored= "true" pageencoding= "gb2312" Import= "Java.sql.*"%>
Iserrorpage (whether the exception object can be used), iselignored (whether or not to ignore the expression)
<% @include file= "filename"%>
<% @taglib prefix= "C" uri= "/http ..."%>
60, under what circumstances call Doget () and Dopost ()?
The method property in the form tag in the JSP page is called doget () when it is get, and Dopost () is called when it is post.
61. The life cycle of the servlet
The Web container loads the servlet, beginning with the life cycle. The servlet is initialized by calling the servlet's init () method. By invoking the service () method implementation, different do*** () methods are called depending on the request. To end the service, the Web container invokes the servlet's Destroy () method.
62, how to live servlet single-threaded mode
<%@ page isthreadsafe= "false"%>
63. How to transfer objects between pages
Request,session,application,cookie, etc.
64. What are the similarities and differences between JSP and servlet, and what are their connections?
JSP is the extension of servlet technology, which is essentially a simple way for servlets to emphasize the appearance of application. The JSP is compiled with a "class servlet". The main difference between Servlets and JSPs is that the application logic of the servlet is in the Java file and is completely detached from the HTML in the presentation layer. The case for JSP is that Java and HTML can be combined into a file with a. jsp extension. JSPs focus on Views, and Servlets are used primarily for control logic.
65. Four kinds of conversation tracking technology
Session Scope servletsjsp Page description
Page no is a representation of the objects and properties associated with a page. A page is represented by a compiled Java servlet class (which can have any include directives, but no include actions). This includes both Servlets and JSP pages that are compiled into Servlets
Request is an object and property that represents a request that is made to a WEB client. A request may span multiple pages, involving multiple WEB components (due to the relationship of the forward directive and the include action)
A session is a representation of objects and properties that are related to a user experience for a WEB client. A Web session can and will often be requested across multiple clients
Application is a representation of objects and properties related to the entire WEB application. This is essentially a global scope that spans the entire WEB application, including multiple pages, requests, and sessions
66. The main method of the Request object:
SetAttribute (String name,object): Sets the parameter value of the request named name
GetAttribute (String name): Returns the property value specified by name
Getattributenames (): Returns a collection of names of all properties of the request object, resulting in an instance of an enumeration
GetCookies (): Returns all cookie objects for the client, as a result of a cookie array
Getcharacterencoding (): Returns the character encoding in the request
Getcontentlength (): Returns the length of the requested body
GetHeader (String name): Gets the file header information defined by the HTTP protocol
Getheaders (String name): Returns all values of the request header for the specified name, resulting in an instance of an enumeration
Getheadernames (): Returns the name of the request header, and the result is an instance of the enumeration
getInputStream (): Returns the requested input stream for obtaining the data in the request
GetMethod (): Obtaining a client's way of transmitting data to the server side
GetParameter (String name): Gets the parameter value specified by the client that is passed to the server side by name
Getparameternames (): Gets the name of all parameters that the client sends to the server side, and the result is an instance of the enumeration
Getparametervalues (String name): Gets all values that have the parameter specified by name
Getprotocol (): Gets the protocol name on which the client transmits data to the server
GetQueryString (): Get query string
Getrequesturi (): Gets the client address that issued the request string
GETREMOTEADDR (): Gets the IP address of the client
Getremotehost (): Gets the name of the client
GetSession ([Boolean create]): Returns and requests the relevant session
getServerName (): Gets the name of the server
Getservletpath (): Gets the path of the script file requested by the client
Getserverport (): Gets the port number of the server
RemoveAttribute (String name): Delete One of the properties in the request
67. Is it a technology or a platform or a framework?
The Java EE itself is a standard, a standard platform for the development of enterprise distributed applications.
The Java EE is also a framework, including JDBC, JNDI, RMI, JMS, EJB, JTA and other technologies.
68, we often encountered in the Web application development process output some kind of encoded characters, such as iso8859-1, how to output a certain encoding of the string?
public string translate (string str) {
String tempstr = "";
try {
TempStr = new String (str.getbytes ("Iso-8859-1", "GBK";
TempStr = Tempstr.trim ();
}
catch (Exception e) {
System.err.println (E.getmessage ());
}
return tempstr;
}
69. Brief description of logical operation (&,|,^) and condition operation (&&,| |) The difference.
The difference between the main answer two: a. Conditional operations can only operate on Boolean, while logical operations not only manipulate Boolean, but also manipulate numeric types
B. Logical operation does not cause a short circuit
70. There are several forms of XML document definition. What are the essential differences between them? What are the different ways to parse an XML document?
A: Two forms of DTD schema,b: The essential difference: The schema itself is XML and can be parsed by the XML parser (which is also the fundamental purpose of developing schema from the DTD), C: dom,sax,stax, etc.
DOM: When working with large files, its performance drops very badly. This problem is caused by the tree structure of the DOM, which takes up more memory, and the DOM must load the entire document into memory before parsing the file, which is appropriate for random access to the XML
SAX: Not present in Dom,sax is an event-driven XML parsing method. It reads the XML file sequentially and does not need to load the entire file at once. When it encounters a file beginning with a document ending, or the beginning of a label with the end of the label, it triggers an event that the user processes the XML file by writing the processing code in its callback event, which is appropriate for sequential access to the XML
Stax:streaming API for XML (STAX)

Java written test one

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.