자바 관련해서 면접시 테크니컬 인터뷰할 때 자주 물어보는 질문들입니다.
아시는 답들 달아주세요. 면접때 어떻게 얘기해야  모범 답안 일까요?

1. What are checked and unchecked exceptions.   
2. Why do you need to have checked exception?
3. How do you throw an exception?
    -Using throw
4. What is factory method pattern? explain with example.
5. How can you restrict the class from creating an object?
    - yes. make the constructor as private
6. what are synchronized methods?
    - Only one thread can access that method at a time.
7. What are the classes that implement List interface?
    - ArrayList, vectors, LinkedList
8. what's the difference between the Vector and ArrayList?
    - Vector-synchronized
    ArrayList-not synchronized, so faster
9. How can you create thread? which method is better and why?
    - By extending Thread class, or by implementing the Runnable interface.
10. If you have a vector and you are iterating over it, and can another thread perform the update operation? what will happen when another thread tries to acces it? will it throw exception?
    - Another thread can not modify the the iterator. There wont be any exception as such, but the thread goes to the waiting state.
11. Can one Jsp extend another JSP?
    yes.
12. What's the difference between include directive and the include action?
    -Static: All the contents of the jsp to be included will directly embedded into the main jsp at the translation time.
    dynamic: The jsp to be included will be compiled and results will be embedded into the main jsp at teh compilation time.
13. Can one class extend two classes?
    -No
14. When a class override the constructor and if you call default constructor what will happen?
    - You need to create your own default constructor.
15. how do you implement composite key in the hibernate?
16. How do you manage the parent and child relation in hibernate?
17. What is interceptors pattern? give example?
18. What is the use of struts framework?
- Easy to use, provide many inbuilt functions, modular
19. What is the essence of AJAX?
    - Asynchronous calls to teh webserver
20. What is the difference between <div> and <span>?
21. When client sends the Ajax request what happens at the server side? did server know it's an AJAX call?
    - server process the request and send back the response. Server has no idea what who raised the request.
22. consider,
          class A {
                String str1;
                String str2;
          }

    if you have two objects,
                      A a = new A();
                      a.str1="hello";
                      a.str2="hello2";
                   
                     A b = new A();
                      b.str1="hello";
                      b.str2="hello2";

if you add these two instances to Set how many objects will be there in the Set? why?
- there will be 2 elements. there is no equals and hashcode() method implemented.

23. Have you made any suggestions to improve the end user experience when it comes to UI?

24. In a JSP,
   
    page.jsp
    <%    int i = 10; %>
   
    page2.jsp also
    <% int i = 10; %>
   
    if you try to do static include of these two above jsps into page3.jsp what will happen?
    - translation error. 'coz of the variable name collision
   
    if you try to do dynamic include of these two above jsps into page3.jsp what will happen?
    - compiles fine
   
25. How can u forward the control one action to another action in struts 1.3?

26. How many instances of the servlet will be created when for multiple requests in a jsp?
    - one

27. Can u configure to make new instances of servlets for each of the user request for a jsp?   
28. When there is an error in the jsp page, internally will it create the servlet? when will be the error generated at translation time or at the compile time.   
    - Error is thrown at translation time. There wont be any servlet generated.
29. Why the compiler will not generate the default constructor when you create your own constructor?
30. Do you refer to different frameworks APIs?    and study them?
31. what are taglibs? why do u need them?
    - taglibgs provide customized features which can be easily plugged in n can be used in the Jsp. If you need any customized features which is not provided by framework's tag library, you can write your own.
32. Can you have only try block with finally without catch? why do you need finally?
    - yes. Mainly used to close some of the costly resources like I/O or connections etc even in case of exception.
33. What are filters? how do you use them? why do u need them?
    - used to manipulate the incoming requests before or after it reaches the servlets. They can be configured in your web.xml.
34. How can you access the html elements?
    - using document object.

1. algorithm, given a string of (a+b)/c*d-e/f...., provide a function algorithm to calculate the actual value assuming the a,b,c,d,e,f ... are integer. what data structure to use.
 
2. is it ok to have the following code running without problem?
 
public class A {
    public int method1 {
    try {
    ...
    } catch ( Exception1 ) {
    ...
    } catch (Exception2 ) {
    ...
    } finally {
      catch (Exception3)
    }
 
3. what are the Clonable interface used for? why does Java have this interface for if nothing is defined in this interface?
4. Can you tell me whether the element in HashSet is ordered as it inputted or if not, what about OrderedSet? how to ensure the data entered into the set is ordered based on the key attribute of the object?