Explain the Struts1/Struts2/MVC application architecture?

Struts was adopted by the Java developer community as a default web framework for developing web applications The MVC(Model–view–controller) an application that consist of three distinct parts. The problem domain is represented by the Model. The output to the user is represented by the View. And, the input from the user is represented by Controller. … Read more

What is the difference between web server and app server?

A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols. In the context of Core Java, the difference between a web server and an application server lies primarily in their roles and functionalities within a web application architecture: Web Server: Role: A web … Read more

What is the difference between final, finally and finalize

final” is the keyword to declare a constant AND prevents a class from producing subclasses. “finally” is a block of code that always executes when the try block is finished, unless System.exit() was called. “finalize()” is an method that is invoked before an object is discarded by the garbage collector. In Core Java, final, finally, and finalize … Read more

What is the wait/notify mechanism?

This deals with concurrent programming. The wait() and notify() methods are designed to provide a mechanism to allow a thread to be block until a specific condition is met. However, java.util.concurrent should be used instead of wait() and notify() to reduce complexity. The wait/notify mechanism in Java is a part of the synchronization features provided … Read more

When will you use Comparator and Comparable interfaces?

java.util.Comparator and java.lang.Comparable java.util.Comparator compares some other class’s instances, while java.lang.Comparable compares itself with another object. In Java, the Comparator and Comparable interfaces are both related to sorting objects, but they serve different purposes: Comparable Interface: The Comparable interface is used for natural ordering of objects. If a class implements the Comparable interface, it means … Read more