1.Java What are the basic data types, String is not a basic data types, what their differences.
2. String operations:
Write a method to achieve reversal of the string, such as: input abc, the output cba
Write a method to achieve a string replacement, such as: input bbbwlirbbb, output bbbhhtccc.
3. Data type conversion between numeric characters How to convert to digital (Integer, Double)
How to convert a number to the decimal point character to get top two, and rounded.
4. Date and time of how to obtain the date, hours, minutes and seconds how to get from 1970 to the
present number of milliseconds how to get a date is the last day of the month how to format date
5. Arrays and collections
6. Files and directories (I / O) operations to list all the files to a directory to a directory listing of all
subdirectories to determine the existence of a file or directory how to read and write files
7.Java polymorphic implementation (inheritance, overloading, coverage)
8. Encoding conversion, how to achieve the GB2312 encoded string converted to ISO-8859-1 encoded
string.
9.Java the steps to access the database, Statement and PreparedStatement differences between them.
10. Locate the following code may be mistakes, and explain the reasons:
4 Other
1.Web security considerations (form validation, browser Basic method validation, application security,
SSL, code consideration)
2. A brief introduction of your understanding of MVC.
3. A brief introduction by the understanding of XML.
4. Documentation and coding standards
5.Java the page, efficiency considerations.
6. A brief introduction you know structs.
-------------------------------------------------- ------------------------------
40. Describe the JVM loads class file of the principles of mechanism?
41. Trial illustrates a typical garbage collection algorithm?
42. Please write java binary tree algorithm, add the data to achieve the formation of binary functions,
and to print out the first-order approach.
43. Please write a java program to achieve thread pooling?
44. Given a C language function, required to achieve a call in the java class.
-------------------------------------------------- ------------------------------
Second, Anonymous Inner Class (anonymous inner classes) it can be extends (inheritance) other classes,
can implements (implementation) interface (interface)?
Anonymous inner classes is not the name of the internal classes. Can not extends (inheritance) other
classes, but an inner class can be used as an interface, by another within the class implements.
Thirdly, Static Nested Class and Inner Class differences, to put the better (surface examination questions,
some very general).
Nested Class (typically C + +, say), Inner Class (usually JAVA view). Java inner class and the C + + nested
classes The biggest difference lies in whether there is a reference point on the outside. Concrete, visible
http://www.frontfree.net/articles/services/view.asp?id=704&page=1
Note: The static inner classes (Inner Class) means that an internal class to create a static object, does not
require an external class object, two from a static inner class can not be an object to access an external
class object
10th, Math.round (11.5) equal to how many? Math.round (-11.5) is equal to how many?
Math.round (11.5) return (long) 12, Math.round (-11.5) return (long) -11;
12th, sleep () and wait () What is the difference? Engage in favorite threads
sleep () method is to make a thread to stop a period of time. In the sleep time interval expires, the
thread is not necessarily an immediate resumption of the implementation. This is because at that time,
other threads may be running but has not been schedule to give up, unless (a) "wake up" the thread has
a higher priority
(b) is running because of other reasons, blocking the thread.
wait () is thread-interaction, if the thread on a synchronization object x issued by a wait () call, the
thread will suspend execution, be transferred to the object into the wait state until it is time to wake up
or wait.
14th, arrays have length () this method? String there any length () this method?
Arrays are not length () This method has length attribute.
String has a length () this method.
15th, Overload, and Override difference. Overloaded methods can change the return value type?
Method of rewriting Overriding and overloading Overloading is different from the performance of Java
polymorphism. Rewrite Overriding parent class and subclass is between a manifestation of
polymorphism, overloading Overloading is a manifestation of polymorphism in class. If the child class
defines a method with the parent class has the same name and parameters, we say that the method has
been rewritten (Overriding). Subclass of an object using this method, it will call the child class definition,
it is concerned, the parent class definition, as being "shielded" the. If a class defines a number of ways
the same name, they may have different number of arguments or parameters of different types, is
called method overloading (Overloading). Overloaded methods can change the return value type.
16th, Set where the elements are not repeated, then the method used to distinguish whether or not to
repeat it? Is to use == or equals ()? Them What's the difference?
Set inside the element is not repeated, then using iterator () method to distinguish whether or not to
repeat. equals () is the interpretation of 2 Set for equality.
equals () and == means to determine whether the point to the same object reference value equals () was
covered in the class, for the two separate objects when the content and type of match, then return true
value.
Map is not a
21st, abstract whether the method is also static, it may be the same native, will it also be synchronized?
Can
22nd, the interface is inheritable interface? Abstract class it can be realized (implements) interface?
Abstract class is inheritable entity class (concrete class)?
Interfaces can be inherited interface. Abstract class can be achieved (implements) interface, abstract
class is inheritable entity class, but only if an entity class must have an explicit constructor.
26th, when a thread into an object of a synchronized method, other threads can enter the object if the
other method?
No, an object of a synchronized method can only be visited by a thread.
27th, try () there is a return statement, then followed this try after finally () where the code will be
executed, when executed, the return before or after?
Will be implemented, and in return the former Executive.
28th, programming problem: The most efficient way to calculate the two multiplied by eight is equal to a
few?
C programmers are particularly fond of the background ask such questions.
2 "" 3
29th, the two objects the same value (x.equals (y) == true), but it may have a different hash code, this
statement is not it?
Does not have the same hash code.
30th, when an object is passed as a parameter to a method, this method can change the properties of
this object, and may return the results after the changes, then here, in the end is passed by value or
reference passed?
Is passed by value. Java programming language to pass parameters only by value. When an object
instance as a parameter is passed to the method, the value of the parameter is a reference to that
object. The contents of the object can be called the method of change, but the object reference will
never change.
31st, swtich whether the role of the byte, on whether the role of the long, on whether the role of the
String on?
switch (expr1) in, expr1 is an integer expression. Therefore, switch and case statements passed to the
parameter should be int, short, char, or byte. long, string can not act on the swtich.
-------------------------------------------------- ------------------------------
-------------------------------------------------- ------------------------------
<! - printpage. asp # # ($ bbslist) loop part of the - "- Author: jiajia1983
- Release Time :2005-3-9 17:29:00
-------------------------------------------------- ------------------------------
Java-based areas:
1, scope public, private, protected, and not write the difference between A: The difference is as follows:
Scope of the current class package descendants of the same class of other package
public √ √ √ √
protected √ √ √ ×
friendly √ √ × ×
private √ × × ×
The default is friendly when you do not write
2, ArrayList and Vector difference, HashMap, and Hashtable difference Answer: ArrayList and Vector,
mainly from two aspects.
1. Synchrony: Vector is thread-safe, meaning that is synchronized, but ArrayList is the line of unsafe
procedures, not synchronized
2. Data growth: When you need to grow, Vector defaults growth of the original one-pei, but ArrayList is
half of the original on the HashMap and HashTable is mainly on three fronts.
1. For historical reasons: Hashtable is based on the old Dictionary class, HashMap is a Java 1.2
introduced an implementation of the Map interface 2. Synchrony: Hashtable is thread-safe, meaning
that is synchronized, while the HashMap is a line of unsafe procedures is not synchronized 3. Value: Only
HashMap allows null values as you would a table entry key or value
4, there are several multi-threaded implementations, What are they? Synchronization There are several
implementations, What are they?
A: There are two multi-threaded implementations, namely, inheritance and implementation of Thread
class Runnable interface, Synchronization, there are two aspects, namely, synchronized, wait and notify
5, when the class inherits the implementation of the order of questions are generally multiple-choice
questions, ask what you will print out?
A: The parent class:
package test;
public class FatherClass
(
public FatherClass ()
(
System.out.println ( "FatherClass Create");
)
)
Sub-categories:
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 Create
Therefore, D wrong 3. Non-static inner class non-static members can access non-static variables outside
the class. Therefore, the correct C 4. Answer is C, E
9, introduced JAVA in the Collection FrameWork (including how to write your own data structure)?
Answer: Collection FrameWork is as follows:
Collection
├ List
│ ├ LinkedList
│ ├ ArrayList
│ └ Vector
│ └ Stack
└ Set
Map
├ Hashtable
├ HashMap
└ WeakHashMap
Collection is the most basic set of interfaces, a Collection on behalf of a group of Object, the Collection
element (Elements)
Map provides a mapping key to value
13, Java's communication programming, programming questions (or question and answer), with JAVA
SOCKET programming, read a few characters in the server, and then written to the local show?
A: Server-side programs:
package test;
import java.net .*;
import java.io. *;
InputStreamReader (System.in));
out = new PrintWriter (socket.getOutputStream (), true);
out.println (line.readLine ());
in = new BufferedReader (new InputStreamReader (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 ();
)
);
14, using JAVA to achieve a sort, JAVA class implements serialization methods (two kinds)? If
COLLECTION framework, to achieve more to realize what kind of interface?
Answer: The insertion sort code 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 <num; 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 <al.size (); 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 <MaxSize; j + +)
(
if
15, programming: write an interception of a string function, input a string and the number of bytes, the
output for the interception by-byte string. However, to ensure that characters are not cut by half, such
as "I ABC" 4, should be cut for the "I AB", enter "I ABC Han DEF", 6, should be output as "I ABC" instead
of "I am half-ABC + Han month. "
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: '" + SplitStr + "'; SplitBytes =" + SplitByte);
)
public void SplitIt ()
(
int loopCount;
Byte +1);
System.out.println ( "Will Split into" + loopCount);
for (int i = 1; i <= loopCount; i + +)
(
if (i == loopCount) (
16, JAVA multi-threaded programming. Use JAVA to write a multi-threaded programs, such as writing
four threads, two plus one, two pairs of a variable by one, the output.
Hope that we make up, thank you
Jsp connection
1, jsp What are the built-in objects? What is the role of each?
Answer: JSP total of the following nine kinds of basic built-in components (ASP-6 with the corresponding
internal components):
request the client request, this request will be included from the GET / POST request parameters
response page returned to the client's response
pageContext page is here to manage property
session session associated with the request period of
application servlet is running the contents of the
used to send out the output response
config servlet framework components
page JSP page itself,
exception for the error page, does not capture the exception
2, jsp What are the actions? What is the role of each?
Answer: JSP total of the following six kinds of basic movements
jsp: include: when the page is requested the introduction of a file.
jsp: useBean: Find or instantiate a JavaBean.
jsp: setProperty: Set JavaBean properties.
jsp: getProperty: Output to a JavaBean property.
jsp: forward: the request to a new page.
jsp: plugin: according to the type of browser plug-ins for the Java generated OBJECT or EMBED tag
Servlet context
2, Servlet version of the rooms (forgot to ask is which of two versions of) the same?
Hope that we make up, thank you
1, it may let you write a Jdbc with Oracle procedures and data queries.
A: The procedure is as follows:
package hello.ant;
import java.sql .*;
public class jdbc
(
String dbUrl = "jdbc: oracle: thin: @ 127.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 ();
)
)
)
4, large amounts of data in the ORACLE page under the solution. A general way with the interception of
ID, there is a three-nested approach.
Answer: 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 intPageCount = 1;
intPageCount = (i% numPages == 0)? (i / numPages): (i / numPages +1);
int nextPage;
int upPage;
nextPage = currentPage +1;
if (nextPage> = 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 <numPages * (currentPage-1)) & & rs.next ()) (i + +;)
%"
/ / Output
/ / Output to connect next page Total: <% = currentPage %>/<%= intPageCount%> <a href="List.jsp?
page=1"> first page </ a> <a
</ a>
Xml in
2, in your project, use the xml technology, what aspects? How to achieve it?
A: The use of data storage, information, configured in two ways. Doing data exchange platform, the data
will not be assembled into a data source XML file, and then encrypted XML file compression package
sent to the recipient through the network, receive decryption and decompression with the XML file and
then restore the relevant information for processing. Do the software configuration, the use of XML can
be easily carried out, the software of various configuration parameters are stored in XML files.
3, using jdom parse xml file how to solve the Chinese problem? How to parse?
A: See the following code, with the encoding to be resolved
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.transform.stream.StreamResult (outFile));
)
catch (Exception e)
(
System.out.println (e.getMessage ());
)
)
)