What are the differences between checked and unchecked exceptions?

A checked exception is any subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces client programmers to deal with the possibility that the exception will be thrown. eg, IOException thrown by java.io.FileInputStream’s read() method Unchecked exceptions are RuntimeException and any of its subclasses. Class Error and its … Read more

What is the difference between forward and sendredirect?

Both method calls redirect you to new resource/page/servlet. The difference between the two is that sendRedirect always sends a header back to the client/browser, containing the data in which you wanted to be redirected. In Java, particularly in the context of servlets and JSP (JavaServer Pages), forward and sendRedirect are two different mechanisms used for … Read more

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