Java Programmer face Question collection (3)

Source: Internet
Author: User
Tags connection pooling dotnet finally block

Topics that have been asked during the interview:

1.<%@ include= ""/> and <jsp:include page= "" flush= "true"/>

2. Know the GOF mode, description

3. What is your long-term plan and what is your recent plan?

4.override and Overload

5.final keywords

6. How the system is layered, foreground, logic, data access. Your responsibilities, how the code guarantees quality

7.getAttribute and GetParameter differences

The difference between 8.forward and redirect

First, Java Fundamentals
1.Java has those basic data types, string is not the basic data type, they are different.
2. String manipulation:
  Write a method to implement string inversion, such as: input ABC, output CBA
  Write a method, implement string substitution, such as: input bbbwlirbbb, output BBBHHTCCC.
3. Conversion between data types
  How to convert numeric characters to numbers (integer,double)
  How to convert numbers to characters
  How to take the first two digits of a decimal point and round.
4. Date and time
  How to get the day, hour and minute
  How to get the number of milliseconds from 1970 to present
  How to get a date is the last day of the month
  How to format the date
5. Arrays and Collections
6. File and directory (I/O) Actions
  How to list all files under a directory
  How to list all subdirectories under a directory
  determine if a file or directory exists
  How to read and write files
7.Java polymorphism implementations (inheritance, overloading, overwriting)
8. Encoding conversion, how to convert a GB2312 encoded string into a iso-8859-1 encoded string.
The steps to access the database in 9.Java, the difference between statement and PreparedStatement.
10. Identify any errors that may exist in the following code and explain why:

Second, Jsp&servlet technology
1. Describe the differences between JSP and servlet, the common denominator, and the scope of their respective applications
2. What to do when working with HTML tags in web development, filter those characters (< > & "")
3. How to read the client's request in JSP, how to access the CGI variable, how to determine the true path of a JSP file.
4. Describe the role of the cookie and the session, the difference and the respective scope of application, session working principle.
5. List how the JSP contains external files, and how they differ.
6. Explain the role of ErrorPage in JSP, the scope of application.
7. Describes how to use JavaBeans in JSP.
8. A simple introduction to the JSP tag library
How the request forwarding in 9.JSP and servlet is implemented separately.

Iii. knowledge about the EE
1. Introduce the difference between the Java EE, J2SE and J2SE.
2.J2EE is a technology or a platform that he provides those technologies.
3. What is application Server, and what features and benefits it has.
4. Brief introduction to the advantages and principles of connection pooling.
The role of 5.web.xml

Iv. Other
1.Web Security Considerations (Form validation, browser basic mode validation, application security, SSL, code considerations)
2. Simply describe the MVC you know.
3. Briefly describe the XML that you know.
4. Documentation and Coding specifications
Paging, efficiency considerations in 5.Java.
6. Simply describe the structs you know.

The role of 1.xml in the project
The difference between 2.S-EJB and E-EJB
3. The role of conversational polygons
Advantages and disadvantages of 4.CMP and BMP
5.j2me Required parts of the program
The difference between 6.c/s and b/s
7. Build a connect pool, and then call it,
The difference between 8.J2EE platform and dotnet platform

9.EJB life cycle
The difference between a 10.session bean and an entity bean
The transaction mechanism in 11.EJB
12.synchronized (producer and consumer)
13.String and StringBuffer
14.Serializable
15.MVC (Struts Workflow)
16. What is MDA

The difference between 17.TCP and UDP
18. The difference between a linked list and a hash table and an array
19. Heap and Stack differences
Classification and difference of 20.EJB
21. Your view of the software industry and the domestic software industry now
22. Talk about Java multithreading
23. Talking about file encryption technology
24. Software Development Life cycle
25. Types and characteristics of routing protocols
The key to the GUI design of the 26.java AWT and swing components
27. Knowledge of Java Streams

28. Briefly describe the difference between AWT and swing.
29. Briefly describe the event handling pattern in Java programming.
30. Have you ever written an applet? What are the security permissions for applets? Try to enumerate the ways in which Java application or applets can communicate with servlet/jsp.

31. Brief description of logical operations (e.g. &,|) With conditional actions (such as &&,| |) The difference.
32. Briefly describe the connection and differences between Java Server Page and Servlet.
33. Describe the similarities and differences between synchronized and Java.util.concurrent.locks.Lock?
What are the 34.EJB specifications that prohibit operations in EJBS?
35.java in addition to 8 basic types, in the virtual machine what else, what role?
36. In addition to using the New keyword to create an object, try to enumerate more than three different ways to create an instance.
37.classloader, what is the difference between the JDK API and the class loading method in Classpath in the same web-inf?
38. List more than three garbage collection algorithms, and compare their pros and cons?
39. Write code to implement a thread pool

40. Describe the mechanism by which the JVM loads the class file?
41. Try to illustrate a typical garbage collection algorithm?  
42. Use Java to write two-fork tree algorithm, to achieve the addition of data to form a two-tree function, and in the first order to print out.  
43. Please write a Java program to implement thread connection pooling function?  
44. Given a C language function, it is required that the implementation be called in the Java class.

45. How do I get the length of an array?
46. Access modifier "public/private/protected/default modifier"
47. What is the point of using the keyword final to decorate a class or method?
48. Mastering the concepts of classes and objects, mastering the nature of object-oriented programming
49. The meaning of static and static methods, how to refer to a static variable or static method of a class? How does the
50.JAVA language do exception handling, keywords: thorws,throw,try,catch,finally
The Finalize () method of the 51.Object class (or its subclasses) under what circumstances is called?
52. Can I include more than one class (not an inner class) in a ". Java" original file?
53. Mastering the concepts of internal classes and interfaces
The use of the 54.StringTokenizer class
55. Data structure, how to traverse the elements in the list?
   What data structure to use if you want to save or access data by key value?
   to master the use of collection-related interfaces and classes
56. What is the difference between using the StringBuffer class to concatenate strings with the string class?
57. What are the consequences of calling the Destroy () method of the thread class?
58. Multi-threading, what keyword is used to modify the synchronization method? Why is the Stop () and suspend () methods not recommended?
59. Process for establishing client-server communication using a socket
60.JAVA language internationalization application, Locale class, Unicode
61. Describe the role of the reflection mechanism
62. How do I read and write a file?
63. In the graphical interface, how does a button handle mouse click events?
64. In the graphical interface, how do I bring up a drop-down box when I edit a cell in a table?
65. How do I load a picture?
66. What is a modal dialog box?
67. Describe the concept of MVC
68.GUI layout manager use, Flowlayout,borderlayout,gridbaglayout
69. How to construct a tree? How do I get this node when I select a node of a tree?
70. How do I control input integers only when I enter characters into the edit box?
71. Describes the process of using JDBC to connect to a database
72.EJB divided into several categories? What is BMP,CMP?
73. What is Jndi?

What is 74.ADO? An ActiveX Data object, which is an application-level program interface.
75. Four JDBC modes? current version?
What kinds of 76.EJB are there? What is the difference?
What is the difference between 77.JavaBean and EJB?
78. What are the phases of the software development life cycle?
79. What are the factors in software development?
80. How is versioning controlled in software development?
In 81.UML, how does Class View represent inheritance and aggregation in a class?
82. What is the difference between a client cursor and a server-side cursor?
83. What is the difference between a dynamic cursor and a static cursor?
What are the basic frameworks for 84.dotnet?
What is the SGA in 85.Oracle?
What is 86.web servers?
What does QT mean in 87.UNIX?
88. At what stage in the software development life cycle do you start testing?
89.dotnet compared to the Java EE?
90. What is ActiveX?
What is IDL in 91.Java?
What are 92.iso9000 and CMM? IS09000 and CMM (software Competency Maturity Model) certification is a common international software quality assessment method. Five maturity levels of the CMM.

《*************************************************************************************************》

First, to talk about final, finally, finalize the difference.
Final modifier (keyword) If a class is declared final, it means that it can no longer derive a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared abstract and declared final. Declaring variables or methods as final ensures that they are not changed in use. A variable declared as final must be given an initial value at the time of declaration, and can only be read in subsequent references and cannot be modified. A method that is declared final can also be used only and cannot be overloaded
Finally? Provides a finally block to perform any cleanup operations when the exception is processed. If an exception is thrown, the matching catch clause executes, and the control enters the finally block, if any.
Finalize? Method name. Java technology allows the use of the Finalize () method to do the necessary cleanup before the garbage collector clears objects from memory. This method is called by the garbage collector to this object when it determines that the object is not referenced. It is defined in the Object class, so all classes inherit it. Subclasses override the Finalize () method to organize system resources or perform other cleanup work. The Finalize () method is called on the object before the object is deleted by the garbage collector.

Second, Anonymous Inner class (anonymous inner Class) can extends (inherit) other classes, can implements (implement) interface (interface)?
The anonymous inner class is an inner class without a name. Other classes cannot be extends (inherited), but an inner class can be implemented as an interface by another inner class.

Thirdly, the Static Nested class and the Inner class are different, the more said the better (some of the questions are very general).
Nested class (generally C + +), Inner class (usually Java's argument). The biggest difference between a Java inner class and a C + + nested class is whether it has an external reference. Specifically visible http://www.frontfree.net/articles/services/view.asp?id=704&page=1
Note: the static inner Class (Inner Class) means that 1 creates an object of the static inner class, does not require an external class object, and 2 cannot access an external class object from an object of a static inner class

The difference between,& and &&.
& is a bitwise operator. && is a boolean logical operator.

The difference between HashMap and Hashtable.
Are classes that are part of the map interface and implement a unique key mapping to a specific value.
HASHMAP classes are not categorized or sorted. It allows a null key and multiple null values.
Hashtable is similar to HASHMAP, but does not allow null keys and null values. It is also slower than HASHMAP, because it is synchronous.

The difference between the Collection and the collections.
Collections is a Java.util class that contains a variety of static methods related to collection operations.
Collection is an interface under Java.util, which is the parent interface of various collection structures.


VII, when to use the Assert.
An assertion is a statement that contains a Boolean expression that is assumed to be true when the statement is executed. If the expression evaluates to False, then the system reports a assertionerror. It is used for debugging purposes:
ASSERT (a > 0); Throws an assertionerror if a <= 0
Assertions can be of two forms:
Assert Expression1;
Assert Expression1:expression2;
Expression1 should always produce a Boolean value.
Expression2 can be any expression that results in a value. This value is used to generate a String message that displays more debugging information.
Assertions are disabled by default. To enable assertions at compile time, you need to use the source 1.4 tag:
Javac-source 1.4 Test.java
To enable assertions at run time, you can use-enableassertions or-ea tags.
To choose to disable assertions at run time, you can use-da or-disableassertions tags.
To enable assertions in the system class, you can use the-esa or-DSA tags. You can also enable or disable assertions on a package basis.
You can place assertions at any location that you expect to not arrive normally. Assertions can be used to validate parameters passed to a private method. However, assertions should not be used to validate parameters passed to public methods, because the public method must check its parameters regardless of whether the assertion is enabled or not. However, assertions can be used in public methods or in non-public methods to test the post conditions. In addition, the assertion should not change the state of the program in any way.


What's the GC? Why do you have a GC? (base).
GC is a garbage collector. Java programmers don't have to worry about memory management because the garbage collector is automatically managed. To request garbage collection, you can call one of the following methods:
System.GC ()
Runtime.getruntime (). GC ()

The ninth, string s = new string ("XYZ"), and the creation of several string Object?
Two objects, one is "XyX", and the other is a reference object pointing to "XyX" s.

Tenth, Math.Round (11.5) how much? Math.Round (-11.5) how much?
Math.Round (11.5) returns (long) 12,math.round (-11.5) return (long)-11;

11th, short S1 = 1; S1 = s1 + 1; what's wrong? Short S1 = 1; S1 + = 1; what's wrong?
Short S1 = 1; S1 = s1 + 1; error, S1 is a short type, s1+1 is an int type, cannot be converted to short type explicitly. Can be modified to S1 = (short) (S1 + 1). Short S1 = 1; S1 + = 1 correct.

12th, what is the difference between sleep () and wait ()? Threading a Favorite
The sleep () method is the method that causes the thread to stop for a period of time. After the sleep interval expires, the thread does not necessarily resume execution immediately. This is because at that point, other threads may be running and not scheduled to abort execution unless (a) the "Wake Up" thread has a higher priority
(b) The running thread is blocked for other reasons.
When wait () is a thread interaction, if the thread makes a wait () call to a synchronization object x, the thread pauses execution, and the object goes into a wait state until it wakes up or waits until the time is up.

13th, does Java have a goto?
The reserved words in Goto?java are not currently used in Java.

14th, 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.

15th, 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.

16th, the elements in set cannot be duplicated, so what is the method used to distinguish between duplicates 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.

17th, give me one of your most common 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

18th, 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.


19th, List, Set, map inherit from collection interface?
List,set is

Map is not

20th, 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.

21st, whether the abstract method can be static at the same time, whether it can be native at the same time, can it be synchronized?
Are not

22nd, can interfaces inherit interfaces? 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.

23rd, 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.

24th, can the constructor constructor be override?
The constructor constructor cannot be inherited, so overriding cannot be overridden, but can be overloaded with overloading.

25th, is it possible to inherit the string class?
The string class is the final class and cannot be inherited.

26th, 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.

27th, there is a return statement in the try {}, then the code in the finally {} immediately after the try will not be executed, when executed, before or after the return?
Executes before the return.


28th, the programming question: the most efficient way to figure out 2 times 8 and so on?
Programmers with C backgrounds are particularly fond of asking such questions.

2 << 3

29th, two object values are the same (x.equals (y) = = true), but can have different hash code, this sentence is not correct?
No, there's the same hash code.

30th, when an object is passed as a parameter to a method, this method can change the properties of the object and return the changed result, so is this a value pass or a reference pass?
is a value pass. The Java programming language only passes parameters by value. 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.


31st, whether the Swtich can function on a byte, whether it can function on a long, whether it can work 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.

32nd, the programming question: 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.

Java Programmer face Question collection (3)

Related Article

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.