Junior Java programmer interview questions Junior Java programmer interview questions What is the purpose of finalization?
What is the purpose of finalization? - The purpose of finalization is to give an unreachable object the- The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
opportunity to perform any cleanup processing before the object is garbage collected.
1.
1. What is the What is the difference betweedifference between the n the Boolean & operator and the Boolean & operator and the && operator?&& operator? - If an expression- If an expression
involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand
evaluation of the second operand is skipped.is skipped.
2.
2. How many times may an object’s finalize() method be invoked by the garbage collector?How many times may an object’s finalize() method be invoked by the garbage collector? - - AnAn
object’s finalize() method may only be invoked once by the garbage collector. object’s finalize() method may only be invoked once by the garbage collector.
3.
3. What is the purpose of the finally clause of a try-catch-finally statement?What is the purpose of the finally clause of a try-catch-finally statement? - The finally clause is- The finally clause is
used to provide the capability to execute code no matter whether or not an exception is thrown or used to provide the capability to execute code no matter whether or not an exception is thrown or caught.
caught.
4.
4. What is the argument type of a program’s main() method?What is the argument type of a program’s main() method? - A program’s main() method takes an- A program’s main() method takes an
argument of the String[] type. argument of the String[] type.
5.
5. Which Java operator is Which Java operator is right associative?right associative? - The = operator is right associative.- The = operator is right associative. 6.
6. Can a double value be cast to a byte?Can a double value be cast to a byte? - Yes, a double value can be cast to a byte.- Yes, a double value can be cast to a byte. 7.
7. What is the difference between a break statement and a continue statement?What is the difference between a break statement and a continue statement? - A break statement- A break statement
results in the termination of the statement to which it applies (switch, for, do, or while). A continue results in the termination of the statement to which it applies (switch, for, do, or while). A continue statement is used to end the current loop iteration and return control to the loop statement.
statement is used to end the current loop iteration and return control to the loop statement.
8.
8. What must a class do to implement an interface?What must a class do to implement an interface? - It must provide all of the methods in the- It must provide all of the methods in the
interface and identify the interface in its implements clause. interface and identify the interface in its implements clause.
9.
9. What is the advantage of the event-delegation model over the earlier event-inheritance model?What is the advantage of the event-delegation model over the earlier event-inheritance model?
- The event-delegation model has two advantages over the event-inheritance model. First, it enables - The event-delegation model has two advantages over the event-inheritance model. First, it enables event handling to be handled by objects other than the ones that generate the events (or their event handling to be handled by objects other than the ones that generate the events (or their containers). This allows a clean separation between a component’s design and its use. The other containers). This allows a clean separation between a component’s design and its use. The other advantage of the event-delegation model is that it performs much better in applications where many advantage of the event-delegation model is that it performs much better in applications where many events are generated. This performance improvement is due to the fact that the event-delegation events are generated. This performance improvement is due to the fact that the event-delegation model does not have to
model does not have to repeaterepeatedly process unhanddly process unhandled events, as led events, as is the is the case of case of the event-inhthe event-inheritanceritancee model.
model.
10.
10.How are commas used in the intialization and iteration parts of a for statement?How are commas used in the intialization and iteration parts of a for statement? - Commas are- Commas are
used to separate multiple statements within the initialization and iteration parts of a for statement. used to separate multiple statements within the initialization and iteration parts of a for statement.
11.
11.What is an abstract method?What is an abstract method? - An - An abstraabstract method is ct method is a method whose implemena method whose implementation is deferredtation is deferred
to a subclass. to a subclass.
12.
12.What value does read() return when it has reached the end of What value does read() return when it has reached the end of a file?a file? - The read() method returns- The read() method returns
-1 when it has reached the end of a file. -1 when it has reached the end of a file.
13.
13.Can a Byte object be cast Can a Byte object be cast to a double value?to a double value? - No, an object cannot be cast to a primitive value.- No, an object cannot be cast to a primitive value. 14.
14.What is the difference between a static and a non-static inner class?What is the difference between a static and a non-static inner class? - A non-static inner class- A non-static inner class
may have object instances that are associated with instances of the class’s outer class. A static inner may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.
class does not have any object instances.
15.
15.If a variable is If a variable is declared as private, where may the variable be accessed?declared as private, where may the variable be accessed? - A private variable may- A private variable may
only be accessed within the class in which it is declared. only be accessed within the class in which it is declared.
16.
16.What is an object’s lock and which object’s have locks?What is an object’s lock and which object’s have locks? - An object’s lock is a mechanism that is- An object’s lock is a mechanism that is
use
synchronized method of an object only after it has acquired the object’s lock. All objects and classes synchronized method of an object only after it has acquired the object’s lock. All objects and classes have locks. A class’s lock is acquired on the class’s Class object.
have locks. A class’s lock is acquired on the class’s Class object.
17.
17.What is the % operator?What is the % operator? - It is referred to as the modulo or remainder operator. It returns the- It is referred to as the modulo or remainder operator. It returns the
remainder of dividing the first operand by the second operand. remainder of dividing the first operand by the second operand.
18.
18.When can an object reference be cast to an interface reference?When can an object reference be cast to an interface reference? - An object reference be cast to- An object reference be cast to
an interface reference when the object implements the referenced interface. an interface reference when the object implements the referenced interface.
19.
19.Which class is extended by all Which class is extended by all other classes?other classes? - The Object class is extended by all other classes.- The Object class is extended by all other classes. 20.
20.Can an object be garbage collected while it is still reachable?Can an object be garbage collected while it is still reachable? - A reachable object cannot be- A reachable object cannot be
garbage collected. Only unreachable objects may be garbage collected. garbage collected. Only unreachable objects may be garbage collected.
21.
21.Is the ternary operator written x : y ? z or x ? y : z ?Is the ternary operator written x : y ? z or x ? y : z ? - It is written x ? y : z.- It is written x ? y : z. 22.
22.How is rounding performed under integer division?How is rounding performed under integer division? - The fractional part of the result is truncated.- The fractional part of the result is truncated.
This is known as rounding toward zero. This is known as rounding toward zero.
23.
23.WWhhaat t iis s tthhe e ddiiffffeerreenncce e bbeettwweeeen n tthhe e RReeaaddeerr//WWrriitteer r ccllaasss s hhiieerraarrcchhy y aannd d tthhee
InputStream/OutputStream class hierarchy?
InputStream/OutputStream class hierarchy? - The Reader/Writer class hierarchy is character-- The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
24.
24.What classes of exceptions may be caught by a catch clause?What classes of exceptions may be caught by a catch clause? - A catch clause can catch any- A catch clause can catch any
exception that may be assigned to the Throwable type. This includes the Error and Exception types. exception that may be assigned to the Throwable type. This includes the Error and Exception types.
25.
25.If a class is declared without any access modifiers, where may the class be accessed?If a class is declared without any access modifiers, where may the class be accessed? - A class- A class
that is declared without any access modifiers is said to have package access. This means that the class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
can only be accessed by other classes and interfaces that are defined within the same package.
26.
26.Does a class inherit Does a class inherit the constructors of its superclass?the constructors of its superclass? - A class does not inherit constructors from- A class does not inherit constructors from
any of its superclasses. any of its superclasses.
27.
27.What is the purpose of the System class?What is the purpose of the System class? - The purpose of the System class is to provide access to- The purpose of the System class is to provide access to
system resources. system resources.
28.
28.Name the eight primitive Java types.Name the eight primitive Java types. - The eight primitive types are byte, char, short, int, long,- The eight primitive types are byte, char, short, int, long,
float, double, and boolean. float, double, and boolean.
29.
29.Which class should you use to obtain design information about an object?Which class should you use to obtain design information about an object? - The Class class is- The Class class is
used to obtain information about an object’s design. used to obtain information about an object’s design.
Core Java interview questions Core Java interview questions Can there be an abstract class with no
Can there be an abstract class with no abstract methods in it?abstract methods in it? - Yes- Yes
1.
1. Can an Interface be final?Can an Interface be final? - No- No 2.
2. Can an Interface have an inner class?Can an Interface have an inner class? - Yes.- Yes.
3
3.. ppuubblliic c iinntteerrffaacce e aabbcc 4.
4. {{ 5
5.. ssttaattiic c iinnt t ii==00; ; vvooiid d dddd(());; 6 6.. ccllaasss s aa11 7. 7. {{ 8 8.. aa11(()) 9. 9. {{ 1 100.. iinntt jj;; 1
111.. SSyysstteemm..oouutt..pprriinnttllnn((""iinnssiiddee""));; 1
122.. }};;
1
133.. ppuubblliic c ssttaattiic c vvooiid d mmaaiinn((SSttrriinng g aa11[[]])) 1
144.. {{
1
16. }
17. }
18. }
19.Can we define private and protected modifiers for variables in interfaces? - No
20.What is Externalizable? - Externalizable is an Interface that extends Serializable Interface. And
sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)
21.What modifiers are allowed for methods in an Interface? - Only public and abstract modifiers are
allowed for methods in interfaces.
22.What is a local, member and a class variable? - Variables declared within a method are “local”
variables. Variables declared within the class i.e not within any methods are “member” variables (global variables). Variables declared within the class i.e not within any methods and are defined as “static” are class variables
23.What are the different identifier states of a Thread? The different identifiers of a Thread are: R
-Running or runnable thread, S - Suspended thread, CW - Thread waiting on a condition variable, MW - Thread waiting on a monitor lock, MS - Thread suspended waiting on a monitor lock
24.What are some alternatives to inheritance? - Delegation is an alternative to inheritance.
Delegation means that you include an instance of another class as an instance variable, and forward messages to the instance. It is often safer than inheritance because it forces you to think about each message you forward, because the instance is of a known class, rather than a new class, and because it doesn’t force you to accept all the methods of the super class: you can provide only the methods that really make sense. On the other hand, it makes you write more code, and it is harder to re-use (because it is not a subclass).
25.Why isn’t there operator overloading? - Because C++ has proven by example that operator
overloading makes code almost impossible to maintain. In fact there very nearly wasn’t even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like
writeInt() and writeByte().
26.What does it mean that a method or field is “static”? - Static variables and methods are
instantiated only once per class. In other words they are class variables, not instance variables. If you change the value of a static variable in a particular object, the value of that variable changes for all instances of that class. Static methods can be referenced with the name of the class rather than the name of a particular object of the class (though that works too). That’s how library methods like System.out.println() work. out is a static field in the java.lang.System class.
27.How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?
28. String hostname = InetAddress.getByName("192.18.97.39").getHostName();
29.Difference between JRE/JVM/JDK?
30.Why do threads block on I/O? - Threads block on i/o (that is enters the waiting state) so that other
threads may execute while the I/O operation is performed.
31.What is synchronization and why is it important? - With respect to multithreading,
synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often leads to significant errors.
32.Is null a keyword? - The null value is not a keyword.
33.Which characters may be used as the second character of an identifier,but not as the first
character of an identifier? - The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier.
34.What modifiers may be used with an inner class that is a member of an outer class? - A
(non-local) inner class may be declared as public, protected, private, static, final, or abstract.
35.How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
-Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. 8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses UTF-16-bit and larger bit patterns.
36.What are wrapped classes? - Wrapped classes are classes that allow primitive types to be accessed
as objects.
37.What restrictions are placed on the location of a package statement within a source code file?
-A package statement must appear as the first line in a source code file (excluding blank lines and comments).
38.What is the difference between preemptive scheduling and time slicing? - Under preemptive
scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
39.What is a native method? - A native method is a method that is implemented in a language other
than Java.
40.What are order of precedence and associativity, and how are they used? - Order of precedence
determines the order in which operators are evaluated in expressions. Associatity determines whether an expression is evaluated left-to-right or right-to-left
41.What is the catch or declare rule for method declarations? - If a checked exception may be
thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.
42.Can an anonymous class be declared as implementing an interface and extending a class? - An
anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
43.What is the range of the char type? - The range of the char type is 0 to 2^16 - 1.
Java interview questions and answers
1. What is garbage collection? What is the process that is responsible for doing that in java?
-Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process
2. What kind of thread is the Garbage collector thread? - It is a daemon thread.
3. What is a daemon thread? - These are the threads which can run without user intervention. The
JVM can exit when there are daemon thread by killing them abruptly.
4. How will you invoke any external process in Java? - Runtime.getRuntime().exec(….)
5. What is the finalize method do? - Before the invalid objects get garbage collected, the JVM give
the user a chance to clean up some resources before it got garbage collected.
6. What is mutable object and immutable object? - If a object value is changeable then we can call it
as Mutable object. (Ex., StringBuffer, …) If you are not allowed to change the value of an object, it is immutable object. (Ex., String, Integer, Float, …)
7. What is the basic difference between string and stringbuffer object? - String is an immutable
object. StringBuffer is a mutable object.
8. What is the purpose of Void class? - The Void class is an uninstantiable placeholder class to hold a
9. What is reflection? - Reflection allows programmatic access to information about the fields,
methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions.
10.What is the base class for Error and Exception? - Throwable 11.What is the byte range? -128 to 127
12.What is the implementation of destroy method in java.. is it native or java code? - This method
is not implemented.
13.What is a package? - To group set of classes into a single unit is known as packaging. Packages
provides wide namespace ability.
14.What are the approaches that you will follow for making a program very efficient? - By
avoiding too much of static methods avoiding the excessive and unnecessary use of synchronized methods Selection of related classes based on the application (meaning synchronized classes for multiuser and non-synchronized classes for single user) Usage of appropriate design patterns Using cache methodologies for remote invocations Avoiding creation of variables within a loop and lot more.
15.What is a DatabaseMetaData? - Comprehensive information about the database as a whole. 16.What is Locale? - A Locale object represents a specific geographical, political, or cultural region 17.How will you load a specific locale? - Using ResourceBundle.getBundle(…);
18.What is JIT and its use? - Really, just a very fast compiler… In this incarnation, pretty much a
one- pass compiler — no offline computations. So you can’t look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, it’s an on-line problem.
19.Is JVM a compiler or an interpreter? - Interpreter
20.When you think about optimization, what is the best way to findout the time/memory
consuming process? - Using profiler
21.What is the purpose of assert keyword used in JDK1.4.x? - In order to validate certain
expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.
22.How will you get the platform dependent values like line separator, path separator, etc., ?
-Using Sytem.getProperty(…) (line.separator, path.separator, …)
23.What is skeleton and stub? what is the purpose of those? - Stub is a client side representation of
the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.
24.What is the final keyword denotes? - final keyword denotes that it is the final implementation for
that method or variable or class. You can’t override that method/variable/class any more.
25.What is the significance of ListIterator? - You can iterate back and forth.
26.What is the major difference between LinkedList and ArrayList? - LinkedList are meant for
sequential accessing. ArrayList are meant for random accessing.
27.What is nested class? - If all the methods of a inner class is static then it is a nested class.
28.What is inner class? - If the methods of the inner class can only be accessed via the instance of the
inner class, then it is called inner class.
29.What is composition? - Holding the reference of the other class within some other class is known as
composition.
30.What is aggregation? - It is a special type of composition. If you expose all the methods of a
composite class and route the method call to the composite method through its reference, then it is called aggregation.
31.What are the methods in Object? - clone, equals, wait, finalize, getClass, hashCode, notify,
notifyAll, toString
32.Can you instantiate the Math class? - You can’t instantiate the math class. All the methods in this
class are static. And the constructor is not public.
33.What is singleton? - It is one of the design pattern. This falls in the creational pattern of the design
pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … }
34.What is DriverManager? - The basic service to manage set of JDBC drivers.
35.What is Class.forName() does and how it is useful? - It loads the class into the ClassLoader. It
returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).
36.Inq adds a question: Expain the reason for each keyword of
public static void main(String args[])
Basic Java interview questions
What is a Marker Interface? - An interface with no methods. Example: Serializable, Remote, Cloneable
1. What interface do you implement to do the sorting? - Comparable
2. What is the eligibility for a object to get cloned? - It must implement the Cloneable interface
3. What is the purpose of abstract class? - It is not an instantiable class. It provides the concrete
implementation for some/all the methods. So that they can reuse the concrete functionality by inheriting the abstract class.
4. What is the difference between interface and abstract class? - Abstract class defined with
methods. Interface will declare only the methods. Abstract classes are very much useful when there is a some functionality across various classes. Interfaces are well suited for the classes which varies in functionality but with the same method signatures.
5. What do you mean by RMI and how it is useful? - RMI is a remote method invocation. Using
RMI, you can work with remote object. The function calls are as though you are invoking a local variable. So it gives you a impression that you are working really with a object that resides within your own JVM though it is somewhere.
6. What is the protocol used by RMI? - RMI-IIOP
7. What is a hashCode? - hash code value for this object which is unique for every object.
8. What is a thread? - Thread is a block of code which can execute concurrently with other threads in
the JVM.
9. What is the algorithm used in Thread scheduling? - Fixed priority scheduling.
10.What is hash-collision in Hashtable and how it is handled in Java? - Two different keys with the
same hash value. Two different entries will be kept in a single hash bucket to avoid the collision.
11.What are the different driver types available in JDBC? - 1. A JDBC-ODBC bridge 2. A
native-API partly Java technology-enabled driver 3. A net-protocol fully Java technology-enabled driver 4. A native-protocol fully Java technology-enabled driver For more information: Driver Description
12.Is JDBC-ODBC bridge multi-threaded? - No
13.Does the JDBCODBC Bridge support multiple concurrent open statements per connection?
- No
15.What is the use of transient? - It is an indicator to the JVM that those variables should not be
persisted. It is the users responsibility to initialize the value when read back from the storage.
16.What are the different level lockings using the synchronization keyword? - Class level lock
Object level lock Method level lock Block level lock
17.What is the use of preparedstatement? - Preparedstatements are precompiled statements. It is
mainly used to speed up the process of inserting/updating/deleting especially when there is a bulk processing.
18.What is callable statement? Tell me the way to get the callable statement? - Callablestatements
are used to invoke the stored procedures. You can obtain the callablestatement from Connection using the following methods prepareCall(String sql) prepareCall(String sql, int resultSetType, int resultSetConcurrency)
19.In a statement, I am executing a batch. What is the result of the execution? - It returns the int
array. The array contains the affected row count in the corresponding index of the SQL.
20.Can a abstract method have the static qualifier? - No
21.What are the different types of qualifier and what is the default qualifier? - public, protected,
private, package (default)
22.What is the super class of Hashtable? - Dictionary
23.What is a lightweight component? - Lightweight components are the one which doesn’t go with the
native call to obtain the graphical units. They share their parent component graphical units to render them. Example, Swing components
24.What is a heavyweight component? - For every paint call, there will be a native call to get the
graphical units. Example, AWT.
25.What is an applet? - Applet is a program which can get downloaded into a client environment and
start executing there.
26.What do you mean by a Classloader? - Classloader is the one which loads the classes into the
JVM.
27.What are the implicit packages that need not get imported into a class file? - java.lang
28.What is the difference between lightweight and heavyweight component? - Lightweight
components reuses its parents graphical units. Heavyweight components goes with the native graphical unit for every component. Lightweight components are faster than the heavyweight components.
29.What are the ways in which you can instantiate a thread? - Using Thread class By implementing
the Runnable interface and giving that handle to the Thread class.
30.What are the states of a thread? - 1. New 2. Runnable 3. Not Runnable 4. Dead
31.What is a socket? - A socket is an endpoint for communication between two machines.
32.How will you establish the connection between the servlet and an applet? - Using the URL, I will
create the connection URL. Then by openConnection method of the URL, I will establish the connection, through which I can be able to exchange data.
33.What are the threads will start, when you start the java program? - Finalizer, Main, Reference
Handler, Signal Dispatcher
Interview questions for Java junior developer position
What gives Java its “write once and run anywhere” nature? - Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent.
1. What are the four corner stones of OOP? - Abstraction, Encapsulation, Polymorphism and
Inheritance.
2. Difference between a Class and an Object? - A class is a definition or prototype whereas an object
is an instance or living representation of the prototype.
3. What is the difference between method overriding and overloading? - Overriding is a method
with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments.
4. What is a “stateless” protocol? - Without getting into lengthy debates, it is generally accepted that
protocols like HTTP are stateless i.e. there is no retention of state between a transaction which is a single request response combination.
5. What is constructor chaining and how is it achieved in Java? - A child object constructor always
first needs to construct its parent (which in turn calls its parent constructor.). In Java it is done via an implicit call to the no-args constructor as the first statement.
6. What is passed by ref and what by value? - All Java method arguments are passed by value.
However, Java does manipulate objects by reference, and all object variables themselves are references
7. Can RMI and Corba based applications interact? - Yes they can. RMI is available with IIOP as
the transport protocol instead of JRMP.
8. You can create a String object as String str = “abc”; Why cant a button object be created as
Button bt = “abc”;? Explain - The main reason you cannot create a button by Button bt1= “abc”; is because “abc” is a literal string (something slightly different than a String object, by the way) and bt1 is a Button object. The only object in Java that can be assigned a literal String is java.lang.String. Important to note that you are NOT calling a java.lang.String constuctor when you type String s = “abc”;
9. What does the “abstract” keyword mean in front of a method? A class? - Abstract keyword
declares either a method or a class. If a method has a abstract keyword in front of it,it is called abstract method.Abstract method hs no body.It has only arguments and return type.Abstract methods act as placeholder methods that are implemented in the subclasses. Abstract classes can’t be instantiated.If a class is declared as abstract,no objects of that class can be created.If a class contains any abstract method it must be declared as abstract.
10.How many methods do u implement if implement the Serializable Interface? - The Serializable
interface is just a “marker” interface, with no methods of its own to implement. Other ‘marker’ interfaces are
11. java.rmi.Remote
12. java.util.EventListener
13.What are the practical benefits, if any, of importing a specific class rather than an entire
package (e.g. import java.net.* versus import java.net.Socket)? - It makes no difference in the generated class files since only the classes that are actually used are referenced by the generated class file. There is another practical benefit to importing single classes, and this arises when two (or more) packages have classes with the same name. Take java.util.Timer and javax.swing.Timer, for
example. If I import java.util.* and javax.swing.* and then try to use “Timer”, I get an error while compiling (the class name is ambiguous between both packages). Let’s say what you really wanted was the javax.swing.Timer class, and the only classes you plan on using in java.util are Collection and HashMap. In this case, some people will prefer to import java.util.Collection and import java.util.HashMap instead of importing java.util.*. This will now allow them to use Timer,
Collection, HashMap, and other javax.swing classes without using fully qualified class names in.
14.What is the difference between logical data independence and physical data independence?
schema. Physical Data Independence - meaning immunity of conceptual schema to changes in the internal schema.
15.What is a user-defined exception? - Apart from the exceptions already defined in Java package
libraries, user can define his own exception classes by extending Exception class.
16.Describe the visitor design pattern? - Represents an operation to be performed on the elements of
an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. The root of a class hierarchy defines an abstract method to accept a visitor. Subclasses implement this method with visitor.visit(this). The Visitor interface has visit methods for all subclasses of the baseclass in the hierarchy.
Java database interview questions and answers
How do you call a Stored Procedure from JDBC? - The first step is to create a CallableStatement object. As with Statement and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure.
1. CallableStatement cs =
2. con.prepareCall("{call SHOW_SUPPLIERS}"); 3. ResultSet rs = cs.executeQuery();
4. Is the JDBC-ODBC Bridge multi-threaded? - No. The JDBC-ODBC Bridge does not support
concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won’t get the advantages of multi-threading.
5. Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?
- No. You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge.
6. What is cold backup, hot backup, warm backup recovery? - Cold backup (All these files must be
backed up at the same time, before the databaseis restarted). Hot backup (official name is ‘online backup’) is a backup taken of each tablespace while the database is running and is being accessed by
the users.
7. When we will Denormalize data? - Data denormalization is reverse procedure, carried out purely
for reasons of improving performance. It maybe efficient for a high-throughput system to replicate data for certain data.
8. What is the advantage of using PreparedStatement? - If we are using PreparedStatement the
execution time will be less. The PreparedStatement object contains not just an SQL statement, but the SQL statement that has been precompiled. This means that when the PreparedStatement is executed,the RDBMS can just run the PreparedStatement’s Sql statement without having to compile it first.
9. What is a “dirty read”? - Quite often in database processing, we come across the situation wherein
one transaction can change a value, and a second transaction can read this value before the original change has been committed or rolled back. This is known as a dirty read scenario because there is
always the possibility that the first transaction may rollback the change, resulting in the second transaction having read an invalid value. While you can easily command a database to disallow dirty reads, this usually degrades the performance of your application due to the increased locking overhead. Disallowing dirty reads also leads to decreased system concurrency.
10.What is Metadata and why should I use it? - Metadata (’data about data’) is information about one
of two things: Database information (java.sql.DatabaseMetaData), or Information about a specific ResultSet (java.sql.ResultSetMetaData). Use DatabaseMetaData to find information about your database, such as its capabilities and structure. Use ResultSetMetaData to find information about the results of an SQL query, such as size and types of columns
11.Different types of Transaction Isolation Levels? - The isolation level describes the degree to which
the data being updated is visible to other transactions. This is important when two transactions are trying to read the same row of a table. Imagine two transactions: A and B. Here three types of inconsistencies can occur:
o Dirty-read: A has changed a row, but has not committed the changes. B reads the
uncommitted data but his view of the data may be wrong if A rolls back his changes and updates his own changes to the database.
o Non-repeatable read: B performs a read, but A modifies or deletes that data later. If B reads
the same row again, he will get different data.
o Phantoms: A does a query on a set of rows to perform an operation. B modifies the table such
that a query of A would have given a different result. The table may be inconsistent.
TRANSACTION_READ_UNCOMMITTED : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR.
TRANSACTION_READ_COMMITTED : DIRTY READS ARE PREVENTED, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR.
TRANSACTION_REPEATABLE_READ : DIRTY READS , NON-REPEATABLE READ ARE PREVENTED AND PHANTOMS CAN OCCUR.
TRANSACTION_SERIALIZABLE : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS ARE PREVENTED.
12.What is 2 phase commit? - A 2-phase commit is an algorithm used to ensure the integrity of a
committing transaction. In Phase 1, the transaction coordinator contacts potential participants in the transaction. The participants all agree to make the results of the transaction permanent but do not do so immediately. The participants log information to disk to ensure they can complete In phase 2 f all the participants agree to commit, the coordinator logs that agreement and the outcome is decided. The recording of this agreement in the log ends in Phase 2, the coordinator informs each participant of the decision, and they permanently update their resources.
13.How do you handle your own transaction ? - Connection Object has a method called
setAutocommit(Boolean istrue)
- Default is true. Set the Parameter to false , and begin your transaction
14.What is the normal procedure followed by a java client to access the db.? - The database
connection is created in 3 steps:
1. Find a proper database URL 2. Load the database driver
3. Ask the Java DriverManager class to open a connection to your database
4. Create a properly formatted JDBR URL for your database. (See FAQ on JDBC URL for more
information). A JDBC URL has the form
jdbc:someSubProtocol://myDatabaseServer/theDatabaseName
5. Class.forName(”my.database.driver”);
6. Connection conn = DriverManager.getConnection(”a.JDBC.URL”,
“databaseLogin”,”databasePassword”);
2. What is a data source? - A DataSource class brings another level of abstraction than directly using a
connection object. Data source can be referenced by JNDI. Data Source may point to RDBMS, file System , any DBMS etc.
3. What are collection pools? What are the advantages? - A connection pool is a cache of database
connections that is maintained in memory, so that the connections may be reused
4. How do you get Column names only for a table (SQL Server)? Write the Query.
-5. select name from syscolumns
6. where id=(select id from sysobjects where name='user_hdr') 7. order by colid --user_hdr is the table name
Common JSP interview questions
What are the implicit objects? - Implicit objects are objects that are created by the web container and contain information related to a particular request, page, or application. They are: request, response, pageContext, session, application, out, config, page, exception.
1. Is JSP technology extensible? - Yes. JSP technology is extensible through the development of
custom actions, or tags, which are encapsulated in tag libraries.
2. How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of
using it? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" %> within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the <%! DECLARE %>tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not
recommended for normal use. There are many pitfalls, including the example above of not being able to use <%! %>. You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe
3. How does JSP handle run-time exceptions? - You can use the errorPage attribute of the page
directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example: <%@ page errorPage="error.jsp" %>
redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: <
%@ page isErrorPage="true" %> Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute.
4. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server %>
5. How do I use comments within a JSP page? - You can use “JSP-style” comments to selectively
block out code while debugging or simply to comment your scriptlets. JSP comments are not visible at the client. For example:
6. <%-- the scriptlet is now commented out 7. <%
8. out.println("Hello World"); 9. %>
10. --%>
You can also use HTML-style comments anywhere within your JSP page. These comments are visible at the client. For example:
<!-- (c) 2004 -->
Of course, you can also use comments supported by your JSP scripting language within your scriptlets. For example, assuming Java is the scripting language, you can have:
<%
//some comment /**
yet another comment **/
%>
11.Response has already been commited error. What does it mean? - This error show only when
you try to redirect a page after you already have written something in your page. This happens because HTTP specification force the header to be set up before the lay out of the page can be shown (to make sure of how it should be displayed, content-type=”text/html” or “text/xml” or “plain-text” or “image/jpg”, etc.) When you try to send a redirect status (Number is line_status_402), your HTTP server cannot send it right now if it hasn’t finished to set up the header. If not starter to set up the header, there are no problems, but if it ’s already begin to set up the header, then your HTTP server expects these headers to be finished setting up and it cannot be the case if the stream of the page is not over… In this last case it’s like you have a file started with <HTML Tag><Some Headers><Body>some output (like testing your variables.) Before you indicate that the file is over (and before the size of the page can be setted up in the header), you try to send a redirect status. It s simply impossible due to the specification of HTTP 1.0 and 1.1
12.How do I use a scriptlet to initialize a newly instantiated bean? - A jsp:useBean action may
optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to
initialize the newly instantiated bean, although you are not restricted to using those alone. The following example shows the “today” property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action.
13. <jsp:useBean id="foo" class="com.Bar.Foo" > 14. <jsp:setProperty name="foo" property="today"
15. value="<%=java.text.DateFormat.getDateInstance().format(new java.util.Date()) %>"/ > 16. <%-- scriptlets calling bean setter methods go here --%>
17. </jsp:useBean >
18.How can I enable session tracking for JSP pages if the browser has disabled cookies? - We
know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair. However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and e ncodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie. Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other. Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page.Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages. Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.
19. hello1.jsp
20. <%@ page session="true" %> 21. <%
22. Integer num = new Integer(100); 23. session.putValue("num",num);
24. String url =response.encodeURL("hello2.jsp"); 25. %>
26. <a href='<%=url%>'>hello2.jsp</a> 27. hello2.jsp
28. <%@ page session="true" %> 29. <%
30. Integer i= (Integer )session.getValue("num");
31. out.println("Num value in session is "+i.intValue());
32.How can I declare methods within my JSP page? - You can declare methods for use within your
JSP page as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions. Do note that you do not have direct access to any of the JSP implicit objects like request, response, session and so forth from within JSP methods. However, you
should be able to pass any of the implicit JSP variables as parameters to the methods you declare. For example:
33. <%!
34. public String whereFrom(HttpServletRequest req) { 35. HttpSession ses = req.getSession();
36. ...
37. return req.getRemoteHost(); 38. }
39. %> 40. <%
41. out.print("Hi there, I see that you are coming in from "); 42. %> 43. <%= whereFrom(request) %> 44. Another Example 45. file1.jsp: 46. <%@page contentType="text/html"%> 47. <%!
48. public void test(JspWriter writer) throws IOException{ 49. writer.println("Hello!"); 50. } 51. %> 52. file2.jsp 53. <%@include file="file1.jsp"%> 54. <html> 55. <body> 56. <%test(out);% > 57. </body> 58. </html>
59. Is there a way I can set the inactivity lease period on a per-session basis? - Typically, a default inactivity lease period for all sessions is set within your JSP engine admin screen or associated properties file. However, if your JSP engine supports the Servlet 2.1 API, you can manage the inactivity lease period on a per-session basis. This is done by invoking the HttpSession.setMaxInactiveInterval() method, right after the session has been created. For example: 60. <%
61. session.setMaxInactiveInterval(300); 62. %>
would reset the inactivity period for this session to 5 minutes. The inactivity interval is set in seconds.
63.How can I set a cookie and delete a cookie from within a JSP page? - A cookie, mycookie, can be
deleted using the following scriptlet: 64. <%
65. //creating a cookie
66. Cookie mycookie = new Cookie("aName","aValue"); 67. response.addCookie(mycookie);
68. //delete a cookie
69. Cookie killMyCookie = new Cookie("mycookie", null); 70. killMyCookie.setMaxAge(0);
71. killMyCookie.setPath("/");
72. response.addCookie(killMyCookie); 73. %>
74.How does a servlet communicate with a JSP page? - The following code snippet shows how a
servlet instantiates a bean and initializes it with FORM data posted by a browser. The bean is then placed into the request, and the call is then forwarded to the JSP page, Bean1.jsp, by means of a
request dispatcher for downstream processing.
75. public void doPost (HttpServletRequest request, HttpServletResponse response) { 76. try {
77. govi.FormBean f = new govi.FormBean(); 78. String id = request.getParameter("id"); 79. f.setName(request.getParameter("name")); 80. f.setAddr(request.getParameter("addr")); 81. f.setAge(request.getParameter("age")); 82. //use the id to compute
83. //additional bean properties like info 84. //maybe perform a db query, etc. 85. // . . .
86. f.setPersonalizationInfo(info); 87. request.setAttribute("fBean",f);
88. getServletConfig().getServletContext().getRequestDispatcher 89. ("/jsp/Bean1.jsp").forward(request, response);
90. } catch (Exception ex) { 91. . . .
92. } 93. }
The JSP page Bean1.jsp can then process fBean, after first extracting it from the default request scope via the useBean action.
jsp:useBean id="fBean" class="govi.FormBean" scope="request" / jsp:getProperty name="fBean" property="name"
/ jsp:getProperty name="fBean" property="addr" / jsp:getProperty name="fBean" property="age"
/ jsp:getProperty name="fBean" property="personalizationInfo" /
94.How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the
default? - One should be very careful when having JSP pages extend custom servlet classes as opposed to the default one generated by the JSP engine. In doing so, you may lose out on any advanced optimization that may be provided by the JSP engine. In any case, your new superclass has
Implementing the HttpJspPage interface, if the protocol used is HTTP, or implementing JspPage otherwise Ensuring that all the methods in the Servlet interface are declared final Additionally, your servlet superclass also needs to do the following:
o The service() method has to invoke the _jspService() method o The init() method has to invoke the jspInit() method
o The destroy() method has to invoke jspDestroy()
If any of the above conditions are not satisfied, the JSP engine may throw a translation error. Once the superclass has been developed, you can have your JSP extend it as follows:
<%@ page extends="packageName.ServletName" %>
95.How can I prevent the word "null" from appearing in my HTML input text fields when I
populate them with a resultset that has null values? - You could make a simple wrapper function, like 96. <%! 97. String blanknull(String s) { 98. return (s == null) ? "" : s; 99. } 100. %>
101. then use it inside your JSP form, like
102. <input type="text" name="shoesize" value="<%=blanknull(shoesize)% >" >
103. How can I get to print the stacktrace for an exception occuring within my JSP page?
-By printing out the exception’s stack trace, you can usually diagonse a problem better when debugging JSP pages. By looking at a stack trace, a programmer should be able to discern which method threw the exception and which method called that method. However, you cannot print the stacktrace using the JSP out implicit variable, which is of type JspWriter. You will have to use a PrintWriter object instead. The following snippet demonstrates how you can print a stacktrace from within a JSP error page:
104. <%@ page isErrorPage="true" %> 105. <% 106. out.println(" "); 107. PrintWriter pw = response.getWriter(); 108. exception.printStackTrace(pw); 109. out.println(" "); 110. %>
111. How do you pass an InitParameter to a JSP? - The JspPage interface defines the jspInit()
and jspDestroy() method which the page writer can use in their pages and are invoked in much the same manner as the init() and destory() methods of a servlet. The example page below enumerates through all the parameters and prints them to the console.
112. <%@ page import="java.util.*" %>
113. <%!
114. ServletConfig cfg =null; 115. public void jspInit(){
116. ServletConfig cfg=getServletConfig();
118. String name=(String)e.nextElement(); 119. String value = cfg.getInitParameter(name); 120. System.out.println(name+"="+value);
121. }
122. }
123. %>
124. How can my JSP page communicate with an EJB Session Bean? - The following is a code
snippet that demonstrates how a JSP page can interact with an EJB session bean:
125. <%@ page import="javax.naming.*, javax.rmi.PortableRemoteObject, foo.AccountHome, foo.Account" %>
126. <%!
127. //declare a "global" reference to an instance of the home interface of the session bean 128. AccountHome accHome=null;
129. public void jspInit() {
130. //obtain an instance of the home interface 131. InitialContext cntxt = new InitialContext( );
132. Object ref= cntxt.lookup("java:comp/env/ejb/AccountEJB");
133. accHome = (AccountHome)PortableRemoteObject.narrow(ref,AccountHome.class);
134. }
135. %>
136. <%
137. //instantiate the session bean
138. Account acct = accHome.create(); 139. //invoke the remote methods
140. acct.doWhatever(...); 141. // etc etc...
142. %>
Java GUI designer interview questions
What advantage do Java’s layout managers provide over traditional windowing systems? - Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java’s layout managers aren’t tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems.
1. What is the difference between the paint() and repaint() methods? - The paint() method supports
painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
2. How can the Checkbox class be used to create a radio button? - By associating Checkbox objects
with a CheckboxGroup
3. What is the difference between a Choice and a List? - A Choice is displayed in a compact form
that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.
4. What interface is extended by AWT event listeners? - All AWT event listeners extend the
5. What is a layout manager? - A layout manager is an object that is used to organize components in a
container
6. Which Component subclass is used for drawing and painting? - Canvas
7. What are the problems faced by Java programmers who dont use layout managers? - Without
layout managers, Java programmers are faced with determining how their GUI will be displayed across multiple windowing systems and finding a common sizing and positioning that will work within the constraints imposed by each windowing system
8. What is the difference between a Scrollbar and a ScrollPane? (Swing) - A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
J2EE interview questions and answers What makes J2EE suitable for distributed multitiered Applications?
- The J2EE platform uses a multitiered distributed application model. Application logic is divided into
components according to function, and the various application components that make up a J2EE application are installed on different machines depending on the tier in the multitiered J2EE environment to which the application component belongs. The J2EE application parts are:
o Client-tier components run on the client machine. o Web-tier components run on the J2EE server. o Business-tier components run on the J2EE server.
o Enterprise information system (EIS)-tier software runs on the EIS server.
2. What is J2EE? - J2EE is an environment for developing and deploying enterprise applications. The
J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.
3. What are the components of J2EE application?
- A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:
1. Application clients and applets are client components.
2. Java Servlet and JavaServer Pages technology components are web components. 3. Enterprise JavaBeans components (enterprise beans) are business components. 4. Resource adapter components provided by EIS and tool vendors.
2. What do Enterprise JavaBeans components contain? - Enterprise JavaBeans components contains
Business code, which is logic
that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier. All the business code is contained inside an Enterprise Bean which receives data from client programs, processes it (if necessary), and sends it to the enterprise information system tier for storage. An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it back to the client program.
3. Is J2EE application only a web-based? - No, It depends on type of application that client wants. A
J2EE application can be web-based or non-web-based. if an application client executes on the client machine, it is a non-web-based J2EE application. The J2EE application can provide a way for users to handle tasks such as J2EE system or application administration. It typically has a graphical user interface created from Swing or AWT APIs, or a command-line interface. When user request, it can open an HTTP connection to establish communication with a servlet running in the web tier.
4. Are JavaBeans J2EE components? - No. JavaBeans components are not considered J2EE
components by the J2EE specification. They are written to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database. JavaBeans components written for the J2EE platform have instance variables and get and set methods for accessing the data in the instance variables. JavaBeans components used in this way are typically simple in design and implementation, but should conform to the naming and design conventions outlined in the JavaBeans component architecture.
5. Is HTML page a web component? - No. Static HTML pages and applets are bundled with web
components during application assembly, but are not considered web components by the J2EE specification. Even the server-side utility classes are not considered web components, either.
6. What can be considered as a web component? - J2EE Web components can be either servlets or
JSP pages. Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content.
7. What is the container? - Containers are the interface between a component and the low-level
platform specific functionality that supports the component. Before a Web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.
8. What are container services? - A container is a runtime support of a system-level entity. Containers
provide components with services such as lifecycle management, security, deployment, and threading.
9. What is the web container? - Servlet and JSP containers are collectively referred to as Web
containers. It manages the execution of JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.
10.What is Enterprise JavaBeans (EJB) container? - It manages the execution of enterprise beans for
J2EE applications.
Enterprise beans and their container run on the J2EE server.
11.What is Applet container? - IManages the execution of applets. Consists of a Web browser and
Java Plugin running on the client together.
12.How do we package J2EE components? - J2EE components are packaged separately and bundled
into a J2EE application for deployment. Each component, its related files such as GIF and HTML files or server-side utility classes, and a deployment descriptor are assembled into a module and added to the J2EE application. A J2EE application is composed of one or more enterprise bean,Web, or application client component modules. The final enterprise solution can use one J2EE application or be made up of two or more J2EE applications, depending on design requirements. A J2EE application and each of its modules has its own deployment descriptor. A deployment descriptor is an XML document with an .xml extension that describes a component’s deployment settings.
13.What is a thin client? - A thin client is a lightweight interface to the application that does not have
such operations like query databases, execute complex business rules, or connect to legacy applications.
14.What are types of J2EE clients? - Following are the types of J2EE clients: o Applets
o Application clients
o Java Web Start-enabled rich clients, powered by Java Web Start technology.