J2ee interview questions and answers for experienced pdf

Friday, February 15, 2019 admin Comments(0)

Enterprise Java – Interview questions & answers . The reason I chose “Java /J2EE Job Interview Companion” is because . How many years of experience. These interview questions and answers on Advanced Java will help you strengthen your technical skills Interview preparation PDF was generated at Monday 12th January, J2EE will be more friendly and efficiency in the code. If you're looking for J2EE Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in .

Language: English, Spanish, Hindi
Country: Cyprus
Genre: Biography
Pages: 782
Published (Last): 09.05.2016
ISBN: 604-9-23881-690-7
ePub File Size: 16.45 MB
PDF File Size: 20.87 MB
Distribution: Free* [*Regsitration Required]
Downloads: 44618
Uploaded by: MARTA

Top 50 J2EE interview questions & Answers. 1) What is J2EE? J2EE means Java 2 Enterprise Edition. The functionality of J2EE is developing multitier web-. The J2EE platform is consists of a set of services, application programming Top 50 J2EE interview questions & Answers .. Download PDF. Advanced J2EE Interview Questions and Answers for Freshers or Experienced Pdf. This interview section questions contains a brief introduction to the Java.

Object is called, as java. Java does not support pointers. Which collection type is NOT used in Hibernate? Can a subclass call the parent's class constructor? The jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet.

Time used Requires timer add on. Your answers are highlighted below.

Pdf j2ee for interview experienced and questions answers

Question 1. Question 2. Question 3. Which method is used to store an object into the database in Hibernate? Question 4. Which method is used to updating the object using identifier in Hibernate?

Question 5. Question 6.

Question 7. Which is NOT a core interface in Hibernate? Question 8. What is the file extension used for hibernate mapping file? Question 9.

What is the file name of hibernate configuration file? Question How to add hibernate mapping file in hibernate configuration file? Which collection type is NOT used in Hibernate? What contains html, javascript and other files, necessary for development of web applications?

Action servlet, request processor and action classes are the components of. In struts application which type is not used for testing? Without new keyword, how can we create objects for a class? Once you are finished, click the button below. Any items you have not completed will be marked incorrect.

Get Results. You have completed. You have not finished your quiz. If you leave this page, your progress will be lost. Download PDF. You Might Like: Error Fixed Reply. Ita a Useful tutorial Reply. Java 2 Entrepreneur Edition. Java 2 Enterprise Edition. Java 2 E- Edition. Java 2 Extension Edition. Java Script Functionality.

Java Server Functionality. JavaServer Faces. Java Script Face. Operational Risk Management. Object Relational Mapping. Object Risk Management. Object Relational Management. Session Interface. Connection Pooling is a simple concept that is popular to reuse the existing connections. In other words, if object connections are already well defined and connected then they can be reused whenever there is a requirement instead of generating the new one.

To reduce the overall complexity of an enterprise application, the open source Spring Framework is used. The major benefits of any spring Framework include —. A collection is defined as one-to-many references. Servlet is a server-side component that offers full functionalities to create a server-side program.

The different servlets are available with a specific design for a variety of protocols. Most popular type of protocol for the servlet is HTTP. The Live classes provide a blended approach of hands on experience along with theoretical knowledge which is driven by certified professionals. Name the different types of J2EE client? Define the struts in the J2EE framework?

Define Hashtable and how it works in J2EE? Define Hibernate and HQL? Explain the limitation of Hibernate, if any? Explain the major benefits of Hibernate? Define the web components and how are they helpful? How will you define save or update methods in Hibernate? How will you differentiate the get and Load methods? List the advantages of ORM object-relational mapping?

Describe the web container in J2EE? Define the concept of connection pooling? Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes. What is an Enum type? An enum type is a special data type that enables for a variable to be a set of predefined constants.

What are Wrapper Classes? What are Primitive Wrapper Classes? A wrapper class is any class which "wraps" or "encapsulates" the functionality of another class or component. A Wrapper Class that wraps or encapsulates the primitive data type is called Primitive Wrapper Class.

Answers questions j2ee experienced and pdf for interview

What Design pattern Wrapper Classes implement? What is "Import" used for? Enables the programmer to abbreviate the names of classes defined in a package. Different types of memory used by JVM? What is a class loader?

J2EE Interview Questions

What are the different class loaders used by JVM? Part of JVM which is used to load classes and interfaces. Can we declare interface methods as private? What is a Static import? By static import , we can access the static members of a class directly without prefixing it with the class name. Difference between StringBuffer and StringBuilder? StringBuffer is synchronized whereas StringBuilder is not.

Difference between Map and HashMap? Map is an interface where HashMap is the concrete class. What is a Property class? The properties class is a subclass of Hashtable that can be read from or written to a stream.

If the Object value will not change in a scenario use String Class because a String object is immutable. If the Object value can change and will only be modified from a single thread, use a StringBuilder because StringBuilder is unsynchronized means faster. If the Object value may change, and can be modified by multiple threads, use a StringBuffer because StringBuffer is thread safe synchronized. Explain java. This Error is thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.

Can we have multiple servlets in a web application and How can we do that? Yes by making entries in web. How can we manage Error Messages in the web application? Within message. Is JVM, a compiler or interpretor? Its an interpretor. Difference between implicit and explicit type casting? An explicit conversion is where you use some syntax to tell the program to do a conversion whereas in case of implicit type casting you need not provide the data type.

Difference between loadClass and Class. Should we override finalize method? Finalize is used by Java for Garbage collection. It should not be done as we should leave the Garbage Collection to Java itself. What is assert keyword used for? The assert keyword is used to make an assertion—a statement which the programmer believes is always true at that point in the program.

This keyword is intended to aid in testing and debugging. Factory Pattern deals with creation of objects delegated to a separate factory class whereas Abstract Factory patterns works around a super-factory which creates other factories.

Difference between Factory and Builder Design Pattern? Builder pattern is the extension of Factory pattern wherein the Builder class builds a complex object in multiple steps.

Difference between Proxy and Adapter? Adapter object has a different input than the real subject whereas Proxy object has the same input as the real subject. Proxy object is such that it should be placed as it is in place of the real subject.

Difference between Adapter and Facade? The Difference between these patterns in only the intent. Adapter is used because the objects in current form cannot communicate where as in Facade , though the objects can communicate , A Facade object is placed between the client and subject to simplify the interface.

Difference between Builder and Composite? Builder is a creational Design Pattern whereas Composite is a structural design pattern. Composite creates Parent - Child relations between your objects while Builder is used to create group of objects of predefined types.

And experienced for questions interview answers pdf j2ee

Example of Chain of Responsibility Design Pattern? Exception Handling Throw mechanism. Example of Observer Design Pattern? Difference between Factory and Strategy Design Pattern? Factory is a creational design pattern whereas Strategy is behavioral design pattern. Factory revolves around the creation of object at runtime whereas Strategy or Policy revolves around the decision at runtime.

Strategy deals only with decision making at runtime so Interfaces should be used. Which kind of memory is used for storing object member variables and function local variables? Local variables are stored in stack whereas object variables are stored in heap. Why do member variables have default values whereas local variables don't have any default value?

In case of local variables, they are stored in stack until they are being used. What is a Default Constructor? The no argument constructor provided by Java Compiler if no constructor is specified.

Will Compiler creates a default no argument constructor if we specify only multi argument constructor? No, Compiler will create default constructor only if we don't specify any constructor. Can we overload constructors? What will happen if we make the constructor private?

We can't create the objects directly by invoking new operator. How can we create objects if we make the constructor private? We can do so through a static public member method or static block. What will happen if we remove the static keyword from main method? Program will compile but will give a "NoSuchMethodError" during runtime. Why Java don't use pointers? Pointers are vulnerable and slight carelessness in their use may result in memory problems and hence Java intrinsically manage their use.

Can we use both "this" and "super" in a constructor? No, because both this and super should be the first statement. Do we need to import java. No, It is loaded by default by the JVM. Is it necessary that each try block to be followed by catch block? It should be followed by either catch or finally block. Can finally block be used without catch? Yes but should follow "try" block then.

What is exception propogation? Passing the exception object to the calling method. Difference between nested and inner classes? Inner classes are non static nested classes. What is a nested interface? Any interface declared inside a class or an interface.

It is static by default. What is an Externalizable interface? Externalizable interface is used to write the state of an object into a byte stream in compressed format. Difference between serializable and externalizable interface?

Serializable is a marker interface whereas externalizable is not. What is reflection? Can we instantiate the object of derived class if parent constructor is protected? Can we declare an abstract method private? No Abstract methods can only be declared protected or public. What are the design considerations while making a choice between using interface and abstract class? Keep it as Interface if its a "Should Do" relationship.

Top 40 Advanced Java/J2EE Interview Questions Answers for Experienced - 3 to 5 Years

What is a config Object? The config object is an instantiation of javax. ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet. This object allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file location. What is a pageContext Object? The pageContext object is an instance of a javax. PageContext object.

The pageContext object is used to represent the entire JSP page. This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.

The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope. What is suspend method used for? We can then restart the thread by using resume method. Difference between suspend and stop? Suspend method is used to suspend thread which can be restarted by using resume method. What are the benefits of using Spring Framework? Spring enables developers to develop enterprise-class applications using POJOs.

Spring is organized in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about ones you need and ignore the rest. Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies.

Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources.

Spring provides a consistent transaction management interface that can scale down to a local transaction. Collections class is a utility class having static methods for doing operations on objects of classes which implement the Collection interface. For example, Collections has methods for finding the max element in a Collection. Will this code give error if i try to add two heterogeneous elements in the arraylist. If we don't declare the list to be of specific type, it treats it as list of objects.

Difference between Java beans and Spring Beans? What is the difference between System. What are various types of Class loaders used by JVM? Bootstrap - Loads JDK internal classes, java. How are classes loaded by JVM? Class loaders are hierarchical. The very first class is specially loaded with the help of static main method declared in your class. All the subsequently loaded classes are loaded by the classes, which are already loaded and running.

Java does not support pointers. Java does not support multiple inheritances. Java does not support destructors but rather adds a finalize method. Finalize methods are invoked by the garbage collector prior to reclaiming the memory occupied by the object, which has the finalize method. Java does not include structures or unions because the traditional data structures are implemented as an object oriented framework.

Java use import to include different Classes and methods. There is no goto statement in Java. There is no scope resolution operator:: It has. You can manipulate machine addresses to look at anything you want. Java access is controlled. Difference between static vs. Tell something about BufferedWriter? What are flush and close used for? A Buffer is a temporary storage area for data. The BufferedWriter class is an output stream. It is an abstract class that creates a buffered character-output stream.

Flush is used to clear all the data characters stored in the buffer and clear the buffer. Close is used to closes the character output stream. What is Scanner class used for? Scanner class introduced in Java 1. Previously we used to write code to read a input using DataInputStream. After reading the stream , we can convert into respective data type using in.

Struts 1 actions are singleton. So all threads operates on the single action object and hence makes it thread unsafe. Struts 2 actions are not singleton and a new action object copy is created each time a new action request is made and hence its thread safe.

What are some Java related technologies used for distributed computing? Whats the purpose of marker interfaces?

They just tell the compiler that the objects of the classes implementing the interfaces with no defined methods need to be treated differently. What is the difference between final, finally and finalize? The finally block is optional and provides a mechanism to clean up regardless of what happens within the try block.

Use the finally block to close files or to release other system resources like database connections, statements etc. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state. When do you get ClassCastException? As we only downcast class in the hierarchy, The ClassCastException is thrown to indicate that code has attempted to cast an object to a subclass of which it is not an instance.

Explain Thread States? Runnable - waiting for its turn to be picked for execution by the thread schedular based on thread priorities. Running - The processor is actively executing the thread code. It runs until it becomes blocked, or voluntarily gives up its turn. Sleeping - Java threads are forcibly put to sleep suspended with Thread. Blocked on synchronization - Will move to Runnable when a lock is acquired. Dead - The thread is finished working. What are strong, soft, weak and phantom references in Java?

A soft reference will only get removed if memory is low. A weak reference will get removed on the next garbage collection cycle. A phantom reference will be finalized but the memory will not be reclaimed. Can be useful when you want to be notified that an object is about to be collected. Difference between yield and sleeping? When a task invokes yield , it changes from running state to runnable state. What is a daemon thread?

Give an Example? These are threads that normally run at a low priority and provide a basic service to a program or programs when activity on a machine is reduced. What is the difference between AWT and Swing? Swing provides extras for components, such as icons on many components, decorative borders for components, tool tips for components etc.

Swing components are lightweight than AWT. Swing provides built-in double buffering ,which means an off-screen buffer is used during drawing and then the resulting bits are copied onto the screen.

Swing provides paint debugging support for when you build your own component. What is the order of method invocation in an applet? Name few tools for probing Java Memory Leaks? JProbe, OptimizeIt. Which memory areas does instance and static variables use? What is J2EE? What are J2EE components and services? J2EE or Java 2 Enterprise Edition is an environment for developing and deploying enterprise applications.

What are the components of J2EE? What is XML? A SAX parser serves the client application always only with pieces of the document at any given time whereas A DOM parser always serves the client application with the entire document no matter how much is actually needed by the client.

A SAX parser, however, is much more space efficient in case of a big input document whereas DOM parser is rich in functionality. Use a DOM Parser if you need to refer to different document areas before giving back the information. Use SAX is you just need unrelated nuclear information from different areas. What is DTD? Your application can use a standard DTD to verify that data that you receive from the outside world is valid and can be parsed by your parser.

What is XSD? What is JAXP? What is JAXB? What is marshalling? What is unmarshalling? Which load testing tools have you used? What are LDAP servers used for? LDAP servers are hierarchical and are optimized for read access, so likely to be faster than database in providing read access.

What is the difference between comparable and comparator in java. Comparable interface is used for single sequence sorting i. What are different modules of spring? The DispatcherServlet configured in web. The DispatcherServlet finds the appropriate Controller with the help of HandlerMapping and then invokes associated Controller.

Then the DispatcherServlet passes the model object to the View. The View is rendered and the Dispatcher Servlet sends the output to the Servlet container.

Finally Servlet Container sends the result back to the user. What is Spring configuration file? Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other. What is default scope of bean in Spring framework? The default scope of bean is Sing leton for Spring framework. What bean scopes does Spring support?

Explain them. The Spring Framework supports following five scopes - Singleton prototype request session global-session. What is bean auto wiring? The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators other beans for your bean by inspecting the contents of the BeanFactory without using and elements.

Difference between socket and servlet? A network socket is an endpoint of an inter-process communication flow across a computer network.

Java / J2EE Interview Questions and Answers

We can think of it as a difference between door and gate. They are similar as they both are entry points but they are different as they are put up at different areas. Sockets are for low-level network communication whereas Servlets are for implementing websites and web services.

Difference Between this and super? What are the phases of the JSP life cycle? Initialization jspInit method is invoked by the container. Destroy jspDestroy method is invoked by the container.

Difference between the jsp scriptlet tag and jsp declaration tag? The jsp scriptlet tag can only declare variables not methods whereas jsp declaration tag can declare variables as well as methods. What are JSP directives? What are different types of directives? The jsp directives are messages that tells the web container how to translate a JSP page into the corresponding servlet. What is Java bytecode?

Java programs are compiled into Java bytecode, which can then be executed by the JVM. What is a Listener?

In GUI programming, an object that can be registered to be notified when events of some given type occur. What is MVC? The model is the data for the component. The view is the visual presentation of the component on the screen.

The controller is responsible for reacting to events by changing the model. According to the MVC pattern, these responsibilities should be handled by different objects. What is race condition? A source of possible errors in parallel programming, where one thread can cause an error in another thread by changing some aspect of the state of the program that the second thread is depending on such as the value of variable.

What is unicode? A way of encoding characters as binary numbers. The Unicode character set includes characters used in many languages, not just English. Unicode is the character set that is used internally by Java. What is ThreadFactory? ThreadFactory is an interface that is meant for creating threads instead of explicitly creating threads by calling new Thread. Its an object that creates new threads on demand. Using thread factories removes hardwiring of calls to new Thread, enabling applications to use special thread subclasses, priorities, etc.

What is PermGen or Permanent Generation? The memory pool containing all the reflective data of the java virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application.

The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here. What is metaspace? The Permanent Generation PermGen space has completely been removed and is kind of replaced by a new space called Metaspace. PermGen error. You can put related classes together as a single logical group. Nested classes can access all class members of the enclosing class, which might be useful in certain cases.

Nested classes are sometimes useful for specific purposes. Explain Static nested Classes? The accessibility public, protected, etc. A static nested class is not an inner class, it's a top-level nested class. The name of the static nested class is expressed with OuterClassName. NestedClassName syntax. When you define an inner nested class or interface inside an interface, the nested class is declared implicitly public and static.

Static nested classes can be declared abstract or final. Static nested classes can extend another class or it can be used as a base class. Static nested classes can have static members. Static nested classes can access the members of the outer class only static members, obviously. The outer class can also access the members even private members of the nested class through an object of nested class. Explain Inner Classes?

Just like top-level classes, an inner class can extend a class or can implement interfaces. Similarly, an inner class can be extended by other classes, and an inner interface can be implemented or extended by other classes or interfaces. An inner class can be declared final or abstract.

Explain Method Local Inner Classes? You can create a non-static local class inside a body of code. Interfaces cannot have local classes, and you cannot create local interfaces.

Local classes are accessible only from the body of the code in which the class is defined.

Welcome to TutorialsEye.com

The local classes are completely inaccessible outside the body of the code in which the class is defined. You can extend a class or implement interfaces while defining a local class. A local class can access all the variables available in the body of the code in which it is defined. You can pass only final variables to a local inner class.

Explain about anonymous inner classes? Anonymous classes are defined in the new expression itself, so you cannot create multiple objects of an anonymous class.

You cannot explicitly extend a class or explicitly implement interfaces when defining an anonymous class. An anonymous inner class is always created as part of a statement; don't forget to close the statement after the class definition with a curly brace. This is a rare case in Java, a curly brace followed by a semicolon. Anonymous inner classes have no name, and their type must be either a subclass of the named type or an implementer of the named interface.

What will happen if class implement two interface having common method? That would not be a problem as both are specifying the contract that implement class has to follow. What is the advantage of using arrays over variables? Arrays provide a structure wherein multiple values can be accessed using single reference and index. This helps in iterating over the values using loops. What are the disadvantages of using arrays? Arrays are of fixed size and have to reserve memory prior to use.

Hence if we don't know size in advance arrays are not recommended to use. Arrays can store only homogeneous elements. Arrays store its values in contentious memory location. Not suitable if the content is too large and needs to be distributed in memory. There is no underlying data structure for arrays and no ready made method support for arrays, for every requriment we need to code explicitly.

Difference between Class getInstance and new operator? Can we create an object if a Class doesn't have any constructor not even the default provided by constructor?

Yes , using Class. What is a cloneable interface and what all methods does it contain? When you will synchronize a piece of your code? When you expect your code will be accessed by different threads and these threads may change a particular data causing data corruption. Are there any global variables in Java, which can be accessed by other part of your program? Global variables are not allowed as it wont fit good with the concept of encapsulation.