Here you can find Java Interview Questions and Answers.
In this Java Interview Questions and Answers section you can learn and practice Java Interview Questions and Answers to improve your skills in order to face technical inerview by IT companies. By Practicing these interview questions, you can easily crack any Java interview.
AllIndiaExams provides you lots Java Interview Questions and Answers with proper explanation. Fully solved examples with detailed answer description. All students, freshers can download Java Interview Questions and Answers as PDF files and eBooks.
You no need to worry, we have given lots of Java Interview Questions and Answers and also we have provided lots of FAQ's to quickly answer the questions in the Java technical interview.
What is the difference between an Abstract class and Interface?
1. Abstract classes may have some executable methods and methods left unimplemented. Interfaces contain no implementation code. 2. An class can implement any number of interfaces, but subclass at most one abstract class. 3. An abstract class can have nonabstract methods. All methods of an interface are abstract. 4. An abstract class can have instance variables. An interface cannot. 5. An abstract class can define constructor. An interface cannot. 6. An abstract class can have any visibility: public, protected, private or none (package). An interface's visibility must be public or none (package). 7. An abstract class inherits from Object and includes methods such as clone() and equals().
What are checked and unchecked exceptions?
Java defines two kinds of exceptions : • Checked exceptions : Exceptions that inherit from the Exception class are checked exceptions. Client code has to handle the checked exceptions thrown by the API, either in a catch clause or by forwarding it outward with the throws clause. Examples - SQLException, IOxception. • Unchecked exceptions : RuntimeException also extends from Exception. However, all of the exceptions that inherit from RuntimeException get special treatment. There is no requirement for the client code to deal with them, and hence they are called unchecked exceptions. Example - Unchecked exceptions are NullPointerException, OutOfMemoryError, DivideByZeroException typically, programming errors.
What is a user defined exception?
User-defined exceptions may be implemented by • defining a class to respond to the exception and • embedding a throw statement in the try block where the exception can occur or declaring that the method throws the exception (to another method where it is handled). The developer can define a new exception by deriving it from the Exception class as follows: public class MyException extends Exception { /* class definition of constructors (but NOT the exception handling code) goes here public MyException() { super(); } public MyException( String errorMessage ) { super( errorMessage ); } } The throw statement is used to signal the occurance of the exception within a try block. Often, exceptions are instantiated in the same statement in which they are thrown using the syntax. throw new MyException("I threw my own exception.") To handle the exception within the method where it is thrown, a catch statement that handles MyException, must follow the try block. If the developer does not want to handle the exception in the method itself, the method must pass the exception using the syntax: public myMethodName() throws MyException
What is the difference between C++ & Java?
Well as Bjarne Stroustrup says "..despite the syntactic similarities, C++ and Java are very different languages. In many ways, Java seems closer to Smalltalk than to C++..". Here are few I discovered: • Java is multithreaded • Java has no pointers • Java has automatic memory management (garbage collection) • Java is platform independent (Stroustrup may differ by saying "Java is a platform" • Java has built-in support for comment documentation • Java has no operator overloading • Java doesn’t provide multiple inheritance
What are statements in JAVA ?
Statements are equivalent to sentences in natural languages. A statement forms a complete unit of execution. The following types of expressions can be made into a statement by terminating the expression with a semicolon • Assignment expressions • Any use of ++ or -- • Method calls • Object creation expressions These kinds of statements are called expression statements. In addition to these kinds of expression statements, there are two other kinds of statements. A declaration statement declares a variable. A control flow statement regulates the order in which statements get executed. The for loop and the if statement are both examples of control flow statements.
What are the Differences between EJB 3.0 and EJB 2.1?
Differences are: 1) EJB 3.0 allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components like EJB 2 (home, remote). 2) In EJB 3.0 you can use annotation or deployment descriptors but in EJB 2 you have to use deployment descriptors. 3) EJB 3 introduced persistence API for database access. In EJB 2 you can use Entity bean. 4) EJB 3.0 is much faster the EJB2
What are the key features of the EJB technology?
1. EJB components are server-side components written entirely in the Java programming language 2. EJB components contain business logic only - no system-level programming & services, such as transactions, security, life-cycle, threading, persistence, etc. are automatically managed for the EJB component by the EJB server. 3. EJB architecture is inherently transactional, distributed, portable multi-tier, scalable and secure. 4. EJB components are fully portable across any EJB server and any OS. 5. EJB architecture is wire-protocol neutral–any protocol can be utilized like IIOP,JRMP, HTTP, DCOM,etc.
What is the difference between EJB and RMI
1. Both of them are java solution for distributed computing. 2. RMI offers remote access to an object running in another JVM and no other services 3. But EJB offers far more services than RMI apart from remote method calling. EJB leverages this remote-object feature of RMI and ORB (RMI-IIOP) which can be called by any COBRA client, but also provides other services such as persistence, transaction management, security, resource management, object pooling and messaging.
What are the ways for a client application to get an EJB object?
1) The client has the JNDI name of the EJB object; this name is used to get the EJB object. 2) The client has the JNDI name of the Home object, this is a more usual case; this name is used to get the Home object, then a finder method is invoked on this Home to obtain one or several entity bean objects. The client may also invoke a "create" method on the Home object to create a new EJB object (session or entity). 3) The client has got a handle on an EJB object. A handle is an object that identifies an EJB object; it may be serialized, stored, and used later by a client to obtain a reference to the EJB Object, using the getEJBObject method(). 4) The client has got a reference to an EJB object, and some methods defined on the remote interface of this Enterprise Bean return EJB objects.
What are the different kinds of enterprise beans?
1. Stateless session bean- An instance of these non-persistent EJBs provides a service without storing an interaction or conversation state between methods. Any instance can be used for any client. 2. Stateful session bean- An instance of these non-persistent EJBs maintains state across methods and transactions. Each instance is associated with a particular client. 3. Entity bean- An instance of these persistent EJBs represents an object view of the data, usually rows in a database. They have a primary key as a unique identifier. Entity bean persistence can be either container-managed or bean-managed. 4. Message-driven bean- An instance of these EJBs is integrated with the Java Message Service (JMS) to provide the ability for message-driven beans to act as a standard JMS message consumer and perform asynchronous processing between the server and the JMS message producer.
what is the advantage of Hibernate over jdbc?
There are so many 1) Hibernate is data base independent, your code will work for all ORACLE,MySQL ,SQLServer etc. In case of JDBC query must be data base specific. So hibernate based persistance logic is database independent persistance logic and JDBC based persistance logic is database dependent logic. 2) As Hibernate is set of Objects , 3) No need to learn SQL language.You can treat TABLE as a Object . Only Java knowledge is need. In case of JDBC you need to learn SQL. 3) Dont need Query tuning in case of Hibernate. If you use Criteria Quires in Hibernate then hibernate automatically tuned your query and return best result with performance. In case of JDBC you need to tune your queries. 4) You will get benefit of Cache. Hibernate support two level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your java cache . 5) Hibernate supports Query cache and It will provide the statistics about your query and database status. JDBC Not provides any statistics. 6) Development fast in case of Hibernate because you dont need to write queries 7) No need to create any connection pool in case of Hibernate. You can use c3p0. In case of JDBC you need to write your own connection pool 8) In the xml file you can see all the relations between tables in case of Hibernate. Easy readability. 9) You can load your objects on start up using lazy=false in case of Hibernate. JDBC Dont have such support. 10 ) Hibernate Supports automatic versioning of rows but JDBC Not.
What is Hibernate?
Hibernate is an open source, light weight Object Relational Mapping tool to develop the database independent persistence login in java and j2ee based applications. Hibernate is a pure Java object-relational mapping (ORM) and persistence framework that allows you to map plain old Java objects to relational database tables using (XML) configuration and mapping files. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks
What is ORM ?
ORM stands for object/relational mapping, means providing the mapping between class with table and member variables with columns is called ORM. ORM is the automated persistence of objects in a Java application to the tables in a relational database.
What does ORM consists of ?
An ORM solution consists of the following four pieces: 1. API for performing basic CRUD operations 2. API to express queries referring to classes 3. Facilities to specify metadata 4. Optimization facilities
What are the ORM levels ?
The ORM levels are: 1. Pure relational (stored procedure) 2. Light objects mapping (JDBC) 3. Medium object mapping 4. Full object Mapping (composition,inheritance, polymorphism, persistence by reachability)
What is an Exception?
An unwanted, unexpected event that disturbs normal flow of the program is called Exception Example: FileNotFondException.
What is the purpose of Exception Handling?
The main purpose of Exception Handling is for graceful termination of the program.
What is the meaning of Exception Handling?
Exception Handling doesn’t mean repairing an Exception, we have to define alternative way to continue rest of the code normally. Example: If our programming requirement is to read the data from the file locating at London but at Runtime if London file is not available then we have to use local file alternatively to continue rest of program normally. This is nothing but Exception Handling.
Explain Default Exception Handling Mechanism in java?
If an exception raised, the method in which it’s raised is responsible for the creation of Exceptions object by including the following information: => Name of the Exception => Description of the Exception => Stack Trace => After creating Exception object the method handover it to the JVM. => JVM checks for Exception Handling code in that method. => If the method doesn’t contain any Exception handling code then JVM terminates the method abnormally and removes the corresponding entry from the stack. => JVM identify the caller method and checks for Exception Handling code in that method. If the caller doesn’t contain any exception handling code then JVM terminates that method abnormally and removes the corresponding entry from the stack. => This process will be continue until main() method. => If the main() method also doesn’t contain exception handling code the JVM terminates that main() method and removes the corresponding entry from the stack. Just before terminating the program abnormally JVM handovers the responsibility of exception handling to the Default Exception Handler which is the component of JVM. Default Exception Handler just print exception information to the consol in the following format Name of Exception: Description Stack Trace (Location of the Exception)
What is the purpose of try?
We should maintain all risky code inside the try block.
What are limitations of object Arrays?
The main limitations of Object arrays are 1. These are fixed in size ie once we created an array object there is no chance of increasing or decreasing size based on our requirement. 2. Hence If we don’t know size in advance , arrays are not recommended to use 3. Arrays can hold only homogeneous elements. 4. There is no underlying data structure for arrays and hence no readymade method support for arrays. 5. Hence for every requirement programmer has to code explicitly 6. To over come these problems collections are recommended to use
What is Collection API ?
It defines set of classes and interfaces which can be used for representing a group of objects as single entity
What is Collection framework?
It defines set of classes and inter faces which can be used for representing a group of objects as single entity
What is difference between Collections and Collection?
Collection is an interface which can be used for representing a group of individual objects as single entity and it acts as root interface of collection frame work. Collections is an utility class to define several utility methods for Collection implemented class objects.
Explain about Collection interface?
* This interface can be used to represent a group of objects as a single entity. * It acts as root interface for entire collection framework. * It defines the most commonly used methods which can be applicable for any collection implemented class object
What is Multitasking?
Executing several task simultaneously is called multitasking.
What is the difference between process-based and Thread-based Multitasking?
Process-based multitasking:- Executing several task simultaneously where each task is a separate independent process such type of multitasking is called process based Multitasking. Example:-While typing a program in the editor we can listen MP3 audio songs. At the same time we download a file from the net.all these task are executing simultaneously and each task is a separate independent program. hence it is process based multitasking. It is best suitable at operating system level. Thread-based multitasking:- Executing several task simultaneously where each task is a separate independent part of the same program is called Thread-based multitasking. and every independent part is called a thread. This type of multitasking is best suitable at programmatic level.
What is Multithreading and explain its application areas?
1. Executing several thread simultaneously where each thread is a separate independent part of the same program is called multithreading. 2. Java language provides inbuilt support for multithreading by defining a reach library, classes and interfaces like Thread, ThreadGroup, Runnable etc. 3. The main important application area of multithreading are video games implementation, animation development, multimedia graphics etc.
What is advantage of Multithreading?
The main advantage of multithreading is reduces response time and improves performance of the system.
When compared with C++ what is the advantage in java with respect to Multithreading?
Java language provides inbuilt support for multithreading by defining a reach library, classes and interfaces like Thread, ThreadGroup, Runnable etc. But in c++ there is no inbuilt support for multithreading.
What is the difference between Database and Database management system?
Database is a collection of interrelated data. Database management system is a software which can be used to manage the data by storing it on to the data base and by retrieving it from the data base. And DBMS is a collection of interrelated data and some set of programs to access the data. There are 3 types of Database Management Systems. Relational DataBase Management Systems(RDBMS): It is a software system, which can be used to represents data in the form of tables. RDBMS will use SQL2 as a Queries language. Object Oriented DataBase Management Systems(OODBMS): It is a software system, which can be used to represent the data in the form of objects. This DBMS will use OQL as a Query language. Object Relational DataBase Management Systems(ORDBMS): It is a DBMS which will represents some part of the data in the form of tables and some other part of the data in the form of objects. This management system will use SQL3 as a Query Language, it is a combination of SQL2 and OQL.
How a query could be executed when we send a query to Database?
When we send an SQL Query from SQL prompt to the DataBase Engine, then Database Engine will take the following steps. Query Tokenization: This phase will take SQL query as an input and devide into stream of tokens. Query Parsing: This phase will take stream of tokens as an input, with them it tried to construct a query tree. If query parser constructs query tree successfully then it was an indication that no grammatical mistakes in the taken SQL query. Otherwise there are some syntactical errors in the taken SQL query. Query Optimization: This phase will take query tree as an input and performs number of query optimization mechanisms to reduce execution time and memory utilization. Query Execution: This phase will take optimized query as an input and executes that SQL query by using interpreters internally as a result we will get some output on the SQL prompt.
What is Driver? How many Drivers are available in JDBC? What are the types?
It is a process of interacting with the database from a java application. -> In JDBC applications we must specify the complete database logic in java application as for the java API representations, later on we need to send java represented database logic to the database engine(DBE). -> DBE must execute the database logic but it was configured as per the java representations but DBE able to understand only Query Language representations. -> At the above situation if we want to execute our database logic, we need to use one interface in between java application and the database, that interface must convert java representations to query language representations and query language representations to java representations. Now this interface is called as a “Driverâ€. Driver: * It is a software or an interface existed in between a java application and database, which will map java api calls with query language api calls and vice versa. * Initially sun Microsystems has provided “driver interface†to the market with this sun Microsystems has given an intimation to all the database vendors to have their own implementation as per their requirements for the Driver interface. * As a response all the database vendors are providing their own implementation for the Driver interface inorder to interact with the respective databases from a java application. * The users of the respective databases they must get the respective database provided Driver implementation from the database software and make use as part of the JDBC applications to interact with the respective databases form a java application. Types of Drivers: There are 180+ number of Drivers in the market. But all these Drivers could be classified into the following 4 types. Type 1 Driver Type 2 Driver Type 3 Driver Type 4 Driver Type 1 Driver: * Type 1 Driver is also called as Jdbc-Odbc Driver or Bridge Driver. * Jdbc-Odbc Driver is an implementation to Driver interface provided by the sun Microsystems along with the java software. * Jdbc-Odbc Driver internally depends on the Microsoft product Odbc Driver. * Odbc is nothing but open database connectivity. * It is a open specification which can be used to interact with any type of databases. Advantages: * This Driver is already available with java software that’s why no need to bother about how to get the Driver implementation explicitily. * Allmost all the databases could support this Driver. Dis advantages: * This Driver internally depends on Odbc Driver that’s why it is not suitable for internet or web applications or network applications. * This Driver is a slower Driver, why because Jdbc-Odbc Driver will convert java calls to Odbc calls. * Then Odbc Driver has to convert Odbc calls to query language calls. * This driver is not portable Driver why because it was not complete the java implementations in Jdbc-Odbc Driver. * It we want to use Jdbc-Odbc Driver in our jdbc applications then we must require to install Odbc-Native Library. Type 2 Driver: Type 2 Driver is also called as “part java part native Driverâ€. i.e., this Driver was designed by using some part of the java implementations and some other part of the database vendor provided native implementations. This Driver is also called as “native driverâ€. Advantages: * When compared to Type 1 driver it is efficient driver why because Type 2 driver directly will convert java api calls to database vendor api calls. Dis advantages: * If we want to use Type 2 Driver in our Jdbc applications then we must require to install database vendor native api. * It is a costful Driver. * It is not suitable for web applicadtions, distributed applications and web applications. * Type 2 Driver performance is low when compared to Type 3 and Type 4 drivers. * This driver is not portable driver. Why because this driver was not designed completely in java technology. Type 3 Driver: * It is also called as middleware database access server driver. * This driver could be used to interact with multiple databases from the multiple clients. * This driver could be used in collaboration with application server. * This driver is suggestable for network applications. Advantages: * It is a fastest driver among all the drivers available in the market. * To use Type 3 driver in our jdbc applications it is not required to install odbc native library and database native library. * It is very much suitable for network applications. Dis advantages: * This driver is not suitable for simple jdbc applications. * This driver requires minimum 3-Tier Architecture. * When compared to Type1 and Type2 drivers.. Type3 driver is efficient and portable. But when compared to Type4 driver, * Type3 driver is not portable. Type 4 Driver: * This driver is also called as pure java driver i.e, this driver was completely implemented by using java technology. * When compared to Type1, Type2 and Type3 drivers.. Type4 driver is portable driver. * Type4 driver can be used for any kind of applications. * Type4 driver is a cheapest driver when compared to all the drivers that’s why it is frequently used driver.
What is JDBC and What are the steps to write a JDBC application?
* The process of interacting with the database from a java application is called as JDBC(Java Database Connectivity) * To interact with the database from a java application we will use the following five steps. * load and register the driver. * Establish a connection between java application and the database. * prepare either statement object or PreparedStatement object or CallebleStatement object as per the application requirements. * write and executer the sql queries. * terminate the connection which we have established.
How to load a JDBC driver?
* In general sun Microsystems has provided Driver interface for this all the database vendors has provided their own implementation. * If we want to use the database vendor provided Driver implementation to our jdbc application, first we need to make the availability of the respective Driver’s .class file to JVM, for this we need to set class path environment variable to the location where we have the driver implementation. * Sun Microsystems is also provided an implementation to the Driver interface in the form of JdbcOdbcDriver class as part of the java software. * If we want to use JdbcOdbcDriver in our jdbc applications no need to set class path environment variable. Why because it was already available in the java software’s pre- defined library. * JdbcOdbcDriver internally depends on the mocrosoft product Odbc driver. If we want to use the JdbcOdbcDriver in our jdbc applications first we must configure Odbc driver, for this we will use the following path. * Start/ conrlol panel / performance and maintenance / administrative tools / data source(Odbc)/ user dsn / click on Add / select microsofr Odbc for oracle / finish / provide data source name only / click on ok / ok. * To load the driver’s class byte code to the memory we will use the following method. Public void forName(String class name) Eg: Class.forName(“sun.jdbc.odbc.JdbcOdbcDriverâ€); Where forName() is a static method, which can be used to load the respective driver class byte code to the memory. * Each and every driver class has already a static block at the time of loading the respective driver class byte code to the memory automatically the available static block could be executed, by this DriverManager.registerDriver(….) method will be executed as part of the static block. * By the execution of the registerDriver(….) method automatically the specified driver will be register to the jdbc application. * If you want to design any jdbc application, we need to use some pre-defined library, which was provided by the Jdbc API in the form of java.sql package, that’s why we need to import java.sql package in our jdbc application.
What is JSF?
* JSF stands for Java Server Faces. JSF has set of pre-assembled User Interface (UI). * By this it means complex components are pre-coded and can be used with ease. * It is event-driven programming model. By that it means that JSF has all necessary code for event handling and component organization. * Application programmers can concentrate on application logic rather sending effort on these issues. * It has component model that enables third-party components to be added like AJAX.
What is required for JSF to get started?
Following things required for JSF: • JDK (Java SE Development Kit) • JSF 1.2 • Application Server (Tomcat or any standard application server) • Integrated Development Environment (IDE) Ex. Netbeans 5.5, Eclipse 3.2.x, etc. Once JDK and Application Server is downloaded and configured, one can copy the JSF jar files to JSF project and could just start coding. :-) If IDE is used, it will make things very smooth and will save your time.
What is JSF architecture?
JSF was developed using MVC (a.k.a Model View Controller) design pattern so that applications can be scaled better with greater maintainability. It is driven by Java Community Process (JCP) and has become a standard. The advantage of JSF is that it’s both a Java Web user – interface and a framework that fits well with the MVC. It provides clean separation between presentation and behavior. UI (a.k.a User Interface) can be created by page author using reusable UI components and business logic part can be implemented using managed beans.
How JSF different from conventional JSP / Servlet Model?
JSF much more plumbing that JSP developers have to implement by hand, such as page navigation and validation. One can think of JSP and servlets as the assembly language under the hood of the high-level JSF framework.
How the components of JSF are rendered? An Example
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> Or one can try XML style as well: xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> Once this is done, one can access the JSF components using the prefix attached. If working with an IDE (a.k.a Integrated Development Environment) one can easily add JSF but when working without them one also has to update/make the faces-config.xml and have to populate the file with classes i.e. Managed Beans between tags
What is JSP ? Describe its concept.
Java Server Pages (JSP) is a server side component for the generation of dynamic information as the response. Best suitable to implement view components (presentation layer components). It is part of SUN’s J2EE platform.
Explain the benefits of JSP?
These are some of the benefits due to the usage of JSP they are: * Portability, reusability and logic components of the language can be used across various platforms. * Memory and exception management. * Has wide range of API which increases the output functionality. * Low maintenance and easy deployment. * Robust performance on multiple requests.
Is JSP technology extensible?
Yes, it is. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.
Can we implement an interface in a JSP?
No
What are the advantages of JSP over Servlet?
* Best suitable for view components * we can separate presentation and business logic * The JSP author not required to have strong java knowledge * If we are performing any changes to the JSP, then not required to recompile and reload explicitly * We can reduce development time.
What is IOC (or Dependency Injection)?
* The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. * You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. * A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up. * i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. * That is, dependencies are injected into objects. * So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects.
What are the different types of IOC (dependency injection) ?
There are three types of dependency injection: 1. Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters. 2. Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods). 3. Interface Injection (e.g. Avalon): Injection is done through an interface.
What are the benefits of IOC (Dependency Injection)?
Benefits of IOC (Dependency Injection) are as follows: 1. Minimizes the amount of code in your application. With IOC containers you do not care about how services are created and how you get references to the ones you need. You can also easily add additional services by adding a new constructor or a setter method with little or no extra configuration. 2. Make your application more testable by not requiring any singletons or JNDI lookup mechanisms in your unit test cases. IOC containers make unit testing and switching implementations very easy by manually allowing you to inject your own objects into the object under test. 3. Loose coupling is promoted with minimal effort and least intrusive mechanism. The factory design pattern is more intrusive because components or services need to be requested explicitly whereas in IOC the dependency is injected into requesting piece of code. Also some containers promote the design to interfaces not to implementations design concept by encouraging managed objects to implement a well-defined service interface of your own. 4. IOC containers support eager instantiation and lazy loading of services. Containers also provide support for instantiation of managed objects, cyclical dependencies, life cycles management, and dependency resolution between managed objects etc.
What is Spring ?
1. Spring is an open source framework created to address the complexity of enterprise application development. 2. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
What are the advantages of Spring framework?
The advantages of Spring are as follows: 1. Spring has layered architecture. Use what you need and leave you don't need now. 2. Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability. 3. Dependency Injection and Inversion of Control Simplifies JDBC 4. Open source and no vendor lock-in.
What is MVC?
Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. Model: The model contains the core of the application's functionality. The model enca psulates the state of the application. Sometimes the only functionality it contains is state. It knows nothing about the view or controller. View: The view provides the presentation of the model. It is the look of the application. The view can access the model getters, but it has no knowledge of the setters. In addition, it knows nothing about the controller. The view should be notified when changes to the model occur. Controller: The controller reacts to the user input. It creates and sets the model.
What is a framework?
Framework is made up of the set of classes which allow us to use a library in a best possible way for a specific requirement.
What is Struts framework?
* Struts framework is an open-source framework for developing the web applications in Java EE, based on MVC-2 architecture. * It uses and extends the Java Servlet API. * Struts is robust architecture and can be used for the development of application of any size. * Struts framework makes it much easier to design scalable, reliable Web applications with Java. * Struts provides its own Controller component and integrates with other technologies to provide the Model and the View. * For the Model, Struts can interact with standard data access technologies, like JDBC and EJB, as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge. For the View, Struts works well with JavaServer Pages, including JSTL and JSF, as well as Velocity Templates, XSLT, and other presentation systems.
What is Jakarta Struts Framework?
Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of the application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.
What is ActionServlet?
* The class org.apache.struts.action.ActionServlet is the called the ActionServlet. * In the the Jakarta Struts Framework this class plays the role of controller. * All the requests to the server goes through the controller. * Controller is responsible for handling all the requests.
|
|
|
|
|
|
|
|
|
|
|