1. HTTPS
To make a application secure, add this in web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>jpweb</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
3. ref : https://www.dineshonjava.com/stereotype-annotations-in-spring/
Note: If you are using component-scan property for context namespace then you no longer need to declare context:annotation-config, because autowiring is implicitly enabled when component scanning is enabled.
4. how to prevent double submission from browser in which JavaScript is disabled?
5. SERVLETS
- 1. What is initialization order of servlet ? What are lifecycle method and who calls them?
- 2. How Servlet and JSP are related to each other ?
- 3. What is Servlet Container, What are responsibilities of Servlet Container?
- 4. What is difference between ServletContext and ServletConfig?
- 5. How to control initialization of Servlet? How will you ensure pre initialization of Servlet?
- 6. What is difference between GenericServlet and HttpServlet?
- 7. What is difference between doGET() and doPOST() method?
- 8. Who calls doGET() and doPOST() method ?
- 9. Who creates object of HttpServletRequest and HttpServletResponse?
- 10. How do you make a Servlet thread safe ?
- 11. What is difference between Servlet and Filter?
- 12. What is lifecycle of filter?
- 13. How do you make your application to run using SSL?
- 14. How do you ensure that a particular servlet can only be accessed after authetincation?
- 15. How to implement authentication and authorization in Servlet application?
- 16. What is advantage of Servlet over CGI?
6. What are major enhancement or features added in Servlet 3.0 API (async processing, annotation, modularization of web.xml etc.)
7. What is asynchronous processing in Servlet? Why do you need that?
8. How do you upload a file using Servlet 3.0
7. What is asynchronous processing in Servlet? Why do you need that?
8. How do you upload a file using Servlet 3.0
9. When a programer should write a filter? How it works ?
10. What is the main purpose of filter?
10. What is the main purpose of filter?
11. If a method throws NullPointerException in the superclass, can we override it with a method which throws RuntimeException?
One more tricky Java questions from the overloading and overriding concept. The answer is you can very well throw superclass of RuntimeException in overridden method, but you can not do same if its checked Exception. See Rules of method overriding in Java for more details.
12. Does two object will always be equal, when there compareTo() method returns zero?
No. Though most of the classes will be equal if there compareTo() return true e.g. java.lang.String, but it's not mandatory. compareTo() may be inconsistent to equals(), which means compareTo() may return zero, but object will not be equal by equals() method.
One of the prime example of this is java.math.BigDecimal class, whose equals() method return true if two BigDecimal object is equal in both value and scale e.g. 6.0 and 6.00 will not be equal, but compareTo() will return zero if both objects are compared
13. Can we store BigDecimal class in TreeSet?
obviously No, because of above reason, BigDecimal class can produce unexpected behavior when stored in SortedSet or SortedMap.
14. difference between "arraylist" and "linkedlist" and when I should use them
15. When Singleton doesn't remain Singleton in Java?
16. is it possible to load a class by two ClassLoader?
Yes, it quite possible if you are using a custom class loader or working on managed environment which uses classloader e.g. web and application server. This is one more reason why you should use instanceof instead of getClass() while overriding equals() mehtod, otherwise equals() will return false even if object are same but classloader is different.
17. is it possible for equals() to return false, even if contents of two Objects are same?
18. Why compareTo() should be consistent to equals() method in Java?
19. is Following code legal in Java? is it example of method overloading or overriding?
public String getDescription(Object obj){
return obj.toString;
}
public String getDescription(String obj){
return obj;
}
18. Why compareTo() should be consistent to equals() method in Java?
19. is Following code legal in Java? is it example of method overloading or overriding?
public String getDescription(Object obj){
return obj.toString;
}
public String getDescription(String obj){
return obj;
}
and
public void getDescription(String obj){
return obj;
}
20. What happens when exception is thrown in a Thread?
21. Difference between notify and notifyAll call?
22. Is null key allowed to stored in HashMap? If yes, how it is handled?
23. What will happen if two different HashMap key objects have same hashcode?
21. Difference between notify and notifyAll call?
22. Is null key allowed to stored in HashMap? If yes, how it is handled?
23. What will happen if two different HashMap key objects have same hashcode?
24. Can you make an abstract class/method final in Java?
No, you cannot make an abstract class or method final in Java
25. https://drive.google.com/file/d/1_kz-Qmkgr5ArDSkrmh4_FNwE2htqCzoI/view?usp=sharing
26. https://self-learning-java-tutorial.blogspot.in/2015/12/java-interview-questions.html
27. http://www.codelect.net/InterviewQuestions/Java-Senior-Level-Test
28. http://code-exercises.com/programming/
29.
26. https://self-learning-java-tutorial.blogspot.in/2015/12/java-interview-questions.html
27. http://www.codelect.net/InterviewQuestions/Java-Senior-Level-Test
28. http://code-exercises.com/programming/
29.
No comments:
Post a Comment