lesforgesdessalles.info Business J2EE INTERVIEW QUESTIONS AND ANSWERS PDF

J2ee interview questions and answers pdf

Saturday, February 16, 2019 admin Comments(0)

Personal and Behavioral/Situational. ▫. Behaving right in an interview. ▫. Key Points. SECTION 2. Interview questions and answers on: Enterprise Java. ▫. J2EE . Java Enterprise Edition(J2EE) Interview Questions And Answers in lesforgesdessalles.info for more Java Enterprise Edition(J2EE) Interview Questions And Answers to. Read the most frequently asked top J2EE Interview Questions and answers for freshers and experienced job interview questions pdf.

Language: English, Spanish, Arabic
Country: Paraguay
Genre: Technology
Pages: 432
Published (Last): 11.05.2016
ISBN: 704-8-26727-138-3
ePub File Size: 21.53 MB
PDF File Size: 9.49 MB
Distribution: Free* [*Regsitration Required]
Downloads: 25373
Uploaded by: TIEN

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.

By putting it within finally. What is filter An object that can transform the header or content or both of a request or response. What are few of the Annotations pre defined by Java? In struts application which type is not used for testing? J2EE Interview Questions 4. Can we call constructor explicitly? Will Compiler creates a default no argument constructor if we specify only multi argument constructor?

Difference between Overloading and Overriding? Overloading - Similar Signature but different definition , like function overloading. Overriding - Overriding the Definition of base class in the derived class. Difference between Vector and ArrayList? Vectors are synchronized whereas Array lists are not. Different ways of implementing Threads in Java?

Threads in Java can be implement either by Extending Thread class or implementing runnable interface. What is Volatile keyword used for? Volatile is a declaration that a variable can be accessed by multiple threads and hence shouldn't be cached.

What is Serialization? Storing the state of an object in a file or other medium is called serialization. What is the use of Transient Keyword? It in Java is used to indicate that a field should not be serialized. What is a final variable? Final variable is a constant variable. Variable value can't be changed after instantiation. What is a Final Method? A Method that cannot be overriden in the sub class.

What is a Final Class? A Class that cannot be sub classed. What is an Immutable Object?

Object that can't be changed after instantiation. What is an immutable class? Class using which only immutable objects that cannot be changed after initialization objects can be created. How to implement an immutable class? We can make a class immutable by 1. Making all methods and variables as private. Setting variables within constructor.

Does Declaring an object "final" makes it immutable? Only declaring primitive types as final makes them immutable. Making objects final means that the object handler cannot be used to target some other object but the object is still mutable.

Difference between object instantiation and construction? Though It's often confused with each other, Object Creation Instantiation and Initialization Construction are different things in Java. Construction follows object creation. Object Creation is the process to create the object in memory and returning its handler. Java provides New keyword for object creation.

Constructor is used for this purpose. If we don't provide any constructor, Java provides one default implementation to set the default values according to the member data types. Can we override static methods?

A static method is not associated with any instance of a class so the concept of overriding for runtime polymorphism using static methods is not applicable. Can we access instance variables within static methods? Static methods belong to a class and not objects whereas non static members are tied to an instance. Accessing instance variables without the instance handler would mean an ambiguity regarding which instance the method is referring to and hence its prohibited.

Can we reduce the visibility of the inherited or overridden method? Give an Example of checked and unchecked exception? Name few Java Exceptions?

Which of the following is tightly bound? Inheritance or Composition? How can we make sure that a code segment gets executed even in case of uncatched exceptions? By putting it within finally. Explain the use of "Native" keyword? Used in method declarations to specify that the method is not implemented in the same Java source file, but rather in another language.

What is "super" used for? Used to access members of the base class. What is "this" keyword used for? Used to represent an instance of the class in which it appears. Difference between boolean and Boolean? What is a finalize method? What are Marker Interfaces? Name few Java marker interfaces?

These are the interfaces which have no declared methods. Serializable and cloneable are marker interfaces. Is runnable a Marker interface? No , it has run method declared. Difference between Process and Thread?

Process is a program in execution whereas thread is a separate path of execution in a program. What is a Deadlock? Difference between Serialization and Deserialization? Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects. Explain Autoboxing? 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. 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?

Questions answers pdf interview j2ee and

What is a class loader? 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. Example of Chain of Responsibility Design Pattern? Exception Handling Throw mechanism. Example of Observer Design Pattern?

J2EE Interview Questions & Answers (Senior, Junior Java Developer)

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.

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.

Interview questions answers pdf and j2ee

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.

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.

And pdf j2ee answers interview questions

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. 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. What is an applet? What is the lifecycle of an applet? Applet is a dynamic and interactive program that runs inside a web page displayed by a java capable browser. Lifecycle methods of Applet - init method - Can be called when an applet is first loaded start method - Can be called each time an applet is started paint method - Can be called when the applet is minimized or maximized stop method - Can be used when the browser moves off the applet's page destroy method - Can be called when the browser is finished with the applet.

These controls are subclasses of Component. What is a stream and what are the types of Streams and classes of the Streams? A Stream is an abstraction that either produces or consumes information.

There are two types of Streams: Byte Streams: Provide a convenient means for handling input and output of bytes. Character Streams: Byte Streams classes: Are defined by using two abstract classes, namely InputStream and OutputStream. Character Streams classes: Are defined by using two abstract classes, namely Reader and Writer. What is session tracking and how do you track a user session in servlets?

Session tracking is a mechanism that servlets use to maintain state about a series requests from the same user across some period of time. The methods used for session tracking are: User Authentication - occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password Hidden form fields - fields are added to an HTML form that are not displayed in the client's browser.

When the form containing the fields is submitted, the fields are sent back to the server URL rewriting - every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information, added parameters or some custom, server-specific URL change. Cookies - a bit of information that is sent by a web server to a browser and which can later be read back from that browser.

HttpSession- places a limit on the number of sessions that can exist in memory. What is connection pooling? It's a technique to allow multiple clients to make use of a cached set of shared and reusable connection objects providing access to a database or other resource. Advantage of Collection classes over Arrays? Collections are re-sizable in nature.

We can increase or decrease the size as per recruitment. Collections can hold both homogeneous and heterogeneous data's. Every collection follows some standard data structures.

Collection provides many useful built in methods for traversing,sorting and search. What are the Disadvantages of using Collection Classes over Arrays? Collections can only hold objects, It can't hold primitive data types. Collections have performance overheads as they deal with objects and offer dynamic memory expansion. This dynamic expansion could be a bigger overhead if the collection class needs consecutive memory location like Vectors.

Collections doesn't allow modification while traversal as it may lead to concurrentModificationException. Can we call constructor explicitly? Does a class inherit the constructor of its super class? What is the difference between float and double?


Float can represent up to 7 digits accurately after decimal point, where as double can represent up to 15 digits accurately after decimal point. It always fills 0 in the sign bit. But System. Is it possible to compile and run a Java program without writing main method? Yes, it is possible by using a static block in the Java program. What are different ways of object creation in Java?

Using new operator - new xyzClass Using factory methods - xyzFactory. What is Generalization and Specialization in terms of casting? Generalization or UpCasting is a phenomenon where a sub class is prompted to a super class, and hence becomes more general. Generalization needs widening or up-casting. Specialization or DownCasting is a phenomenon where a super class is narrowed down to a sub class.

Specialization needs narrowing or down-casting. Can we call the garbage collector explicitly? Yes, We can call garbage collector of JVM to delete any unused variables and unreferenced objects from memory using gc method. This gc method appears in both Runtime and System classes of java.

How does volatile affect code optimization by compiler? Volatile is an instruction that the variables can be accessed by multiple threads and hence shouldn't be cached. As volatile variables are never cached and hence their retrieval cannot be optimized. Do you think that Java should have had pointers?

Open ended Questions. How would you go about debugging a NullPointerException? How does Java differ from other programming languages you've worked with?

Should good code be self-documenting, or is it the responsibility of the developer to document it? What are points to consider in terms of access modifier when we are overriding any method?

Overriding method can not be more restrictive than the overridden method. If by means subclass were allowed to change the access modifier on the overriding method, then suddenly at runtime—when the JVM invokes the true object's version of the method rather than the reference type's version then it will be problematic 2. In case of subclass and superclass define in different package, we can override only those method which have public or protected access.

We can not override any private method because private methods can not be inherited and if method can not be inherited then method can not be overridden.

How compiler handles the exceptions in overriding? In this case , if superclass method throws any checked exception , then while overriding the method in subclass we can not throw any new checked exception or any checked exception which are higher in hierarchy than the exception thrown in superclass method. Why is Java considered Portable Language?

Java is a portable-language because without any modification we can use Java byte-code in any platform which supports Java. So this byte-code is portable and we can use in any other major platforms.

Tell something about history of Java?

At first it was called as "Oak". In then it was later renamed to "Java". Currently Oracle, America owns Java. How to find if JVM is 32 or 64 bit from Java program. You can find JVM - 32 bit or 64 bit by using System. Does every class needs to have one non parameterized constructor?

Every Class only needs to have one constructor - With parameters or without parameters. Compiler provides a default non parameterized constructor if no constructors is defined. Difference between throw and throws? We cannot throw multiple exceptions using throw statement but we can declare that a method can throw multiple exceptions using throws and comma separator.

Can we use "this" within static method? Even though "this" would mean a reference to current object id the method gets called using object reference but "this" would mean an ambiguity if the same static method gets called using Class name. Similarity and Difference between static block and static method? Both belong to the class as a whole and not to the individual objects. Static methods are explicitly called for execution whereas Static block gets executed when the Class gets loaded by the JVM.

What are the platforms supported by Java Programming Language? How Java provide high Performance? Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode into instructions that can be sent directly to the processor.

What is IDE? List few Java IDE? What is an Object? Object is a run time entity whose state is stored in fields and behavior is shown via methods. The application client module contains: Application client modules are packaged as JAR files with a.

What does web module contain? The web module contains: Web modules are packaged as JAR files with a. What are the differences between Ear, Jar and War files? Under what circumstances should we use each one? There are no structural differences between the files they are all archived using zip-jar compression.

However, they are intended for different purposes. In this context, a Web application is defined as a single group of files, classes, resources,. In this context, an enterprise application is defined as a collection of. Each type of file. What is the difference between Session bean and Entity bean? Session Bean —represents a workflow on behalf of a cliennt —one-to-one logical mapping to a client. What is authorization? The process by which access to a method or resource is determined.

Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.

What is authorization constraint An authorization rule that determines who is permitted to access a Web resource collection. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.

What is bean-managed transaction A transaction whose boundaries are defined by an enterprise bean. What is binding JavaServer Faces technology Wiring UI components to back-end data sources such as backing bean properties. What is build file The XML file that contains one or more asant targets.

A target is a set of tasks you want to be executed. When starting asant, you can select which targets you want to have executed. What is business logic The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean. What is business method A method of an enterprise bean that implements the business logic or rules of an application. What is callback methods Component methods called by the container to notify the component of important events in its life cycle.

What is caller principal The principal that identifies the invoker of the enterprise bean method. What is cascade delete A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence. What is certificate authority A trusted organization that issues public key certificates and provides identification to the bearer.

What is client-certificate authentication An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X. What is comment In an XML document, text that is ignored unless the parser is specifically told to recognize it.

What is commit The point in a transaction when all updates to any resources involved in the transaction are made permanent. What is component contract The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.

What is component-managed sign-on A mechanism whereby security information needed for signing on to a resource is provided by an application component. What is connector A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity.

The resource adapter is plugged in to a container through its support for system-level contracts defined in the Connector architecture. What is Connector architecture An architecture for integration of J2EE products with enterprise information systems.

There are two parts to this architecture: This architecture defines a set of contracts that a resource adapter must support to plug in to a J2EE product-for example, transactions, security, and resource management.

What is container An entity that provides life-cycle management, security, deployment, and runtime services to J2EE components. What is container-managed sign-on The mechanism whereby security information needed for signing on to a resource is supplied by the container.

What is container-managed transaction A transaction whose boundaries are defined by an EJB container. An entity bean must use container-managed transactions.

What is content In an XML document, the part that occurs after the prolog, including the root element and everything it contains. What is context root A name that gets mapped to the document root of a Web application. The transitive closure of a bean is defined in terms of the serialization protocol for the Java programming language, that is, the fields that would be stored by serializing the bean instance.

A language-independent distributed object model specified by the OMG. What is create method A method defined in the home interface and invoked by a client to create an enterprise bean.

What is CSS Cascading style sheet. A stylesheet used with HTML and XML documents to add a style to all elements marked with a particular tag, for the direction of browsers or other presentation mechanisms. What is CTS Compatibility test suite. What is data? The contents of an element in an XML stream, generally used when the element does not contain any subelements. When it does, the term content is generally used. When the only text in an XML structure is contained in simple elements and when elements that have subelements have little or no data mixed in, then that structure is often thought of as XML data, as opposed to an XML document.

The minimal declaration is. The declaration is part of the document prolog. What is declarative security Mechanisms used in an application that are expressed in a declarative syntax in a deployment descriptor. What is delegation An act whereby one principal authorizes another principal to use its identity or privileges with some restrictions.

What is deployer A person who installs J2EE modules and applications into an operational environment. What is deployment The process whereby software is installed into an operational environment.

The deployment descriptor directs a deployment tool to deploy a module or application with specific container options and describes specific configuration requirements that a deployer must resolve.

What is digest authentication An authentication mechanism in which a Web application authenticates itself to a Web server by sending the server a message digest along with its HTTP request message.

What is distributed application An application made up of distinct components running in separate runtime environments, usually on different platforms connected via a network.

Typical distributed applications are two-tier client-server , three-tier client-middleware-server , and multitier client-multiple middleware-multiple servers. What is document In general, an XML structure in which one or more elements contains text intermixed with subelements. DOM provides platform-neutral, language-neutral interfaces that enables programs and scripts to dynamically access and modify content and structure in XML documents.

What is document root The top-level directory of a WAR.