Adv Java Interview Questions & Answers

4 avg. rating (80% score) - 1 votes

Adv Java Interview Questions & Answers

Adv Java Interview Questions

Adv Java Interview Questions
    1. Question 1. What Is A Transient Variable?

      Answer :

      A transient variable is a variable that may not be serialized.

    2. Question 2. Which Containers Use A Border Layout As Their Default Layout?

      Answer :

      The Window, Frame and Dialog classes use a border layout as their default layout.

    3. Question 3. Why Do Threads Block On I/o?

      Answer :

      Threads block on I/O (that is enters the waiting state) so that other threads may execute while the I/O Operation is performed.

    4. Question 4. How Are Observer And Observable Used?

      Answer :

      Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.

    5. Question 5. What Is Synchronization And Why Is It Important?

      Answer :

      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.

    6. Question 6. Can A Lock Be Acquired On A Class?

      Answer :

      Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object..

    7. Question 7. What's New With The Stop(), Suspend() And Resume() Methods In Jdk 1.2?

      Answer :

      The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.

    8. Question 8. Is Null A Keyword?

      Answer :

      The null is not a keyword.

    9. Question 9. What Is The Preferred Size Of A Component?

      Answer :

      The preferred size of a component is the minimum component size that will allow the component to display normally.

    10. Question 10. What Method Is Used To Specify A Container's Layout?

      Answer :

      The setLayout() method is used to specify a container's layout.

    11. Question 11. Which Containers Use A Flowlayout As Their Default Layout?

      Answer :

      The Panel and Applet classes use the FlowLayout as their default layout.

    12. Question 12. What State Does A Thread Enter When It Terminates Its Processing?

      Answer :

      When a thread terminates its processing, it enters the dead state.

    13. Question 13. What Is The Collections Api?

      Answer :

      The Collections API is a set of classes and interfaces that support operations on collections of objects.

    14. Question 14. Which Characters May Be Used As The Second Character Of An Identifier, But Not As The First Character Of An Identifier?

      Answer :

      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.

    15. Question 15. What Is The List Interface?

      Answer :

      The List interface provides support for ordered collections of objects.

    16. Question 16. How Does Java Handle Integer Overflows And Underflows?

      Answer :

      It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.

    17. Question 17. What Is The Vector Class?

      Answer :

      The Vector class provides the capability to implement a growable array of objects.

    18. Question 18. What Modifiers May Be Used With An Inner Class That Is A Member Of An Outer Class?

      Answer :

      A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.

    19. Question 19. What Is An Iterator Interface?

      Answer :

      The Iterator interface is used to step through the elements of a Collection.

    20. Question 20. What Is The Difference Between The >> And >>> Operators?

      Answer :

      The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out.

    21. Question 21. Which Method Of The Component Class Is Used To Set The Position And Size Of A Component?

      Answer :

      setBounds() method is used to set the position and size of a component.

    22. Question 22. What Is The Difference Between Yielding And Sleeping?

      Answer :

      When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.

    23. Question 23. Which Java.util Classes And Interfaces Support Event Handling?

      Answer :

      The EventObject class and the EventListener interface support event processing.

    24. Question 24. Is Sizeof A Keyword?

      Answer :

      The sizeof operator is not a keyword.

    25. Question 25. What Are Wrapped Classes?

      Answer :

      Wrapped classes are classes that allow primitive types to be accessed as objects.

    26. Question 26. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?

      Answer :

      Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.

    27. Question 27. What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?

      Answer :

      A package statement must appear as the first line in a source code file (excluding blank lines and comments).

    28. Question 28. Can An Object's Finalize() Method Be Invoked While It Is Reachable?

      Answer :

      An object's finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object's finalize() method may be invoked by other objects.

    29. Question 29. What Is The Immediate Superclass Of The Applet Class?

      Answer :

      Panel.

    30. Question 30. What Is The Difference Between Preemptive Scheduling And Time Slicing?

      Answer :

      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.

    31. Question 31. Name Three Component Subclasses That Support Painting.

      Answer :

      The Canvas, Frame, Panel, and Applet classes support painting.

    32. Question 32. What Value Does Readline() Return When It Has Reached The End Of A File?

      Answer :

      The readLine() method returns null when it has reached the end of a file.

    33. Question 33. What Is The Immediate Superclass Of The Dialog Class?

      Answer :

      Window.

    34. Question 34. What Is Clipping?

      Answer :

      Clipping is the process of confining paint operations to a limited area or shape.

    35. Question 35. What Is A Native Method?

      Answer :

      A native method is a method that is implemented in a language other than Java.

    36. Question 36. Can A For Statement Loop Indefinitely?

      Answer :

      Yes, a for statement can loop indefinitely. For example, consider the following:
      for(;;) ;

    37. Question 37. What Are Order Of Precedence And Associativity, And How Are They Used?

      Answer :

      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.

    38. Question 38. When A Thread Blocks On I/o, What State Does It Enter?

      Answer :

      A thread enters the waiting state when it blocks on I/O.

    39. Question 39. To What Value Is A Variable Of The String Type Automatically Initialized?

      Answer :

      The default value of an String type is null.

    40. Question 40. What Is The Catch Or Declare Rule For Method Declarations?

      Answer :

      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.

    41. Question 41. What Is The Difference Between A Menuitem And A Checkboxmenuitem?

      Answer :

      The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.

    42. Question 42. What Is A Task's Priority And How Is It Used In Scheduling?

      Answer :

      A task's priority is an integer value that identifies the relative order in which it should be executed with respect to other tasks. The scheduler attempts to schedule higher priority tasks before lower priority tasks.

    43. Question 43. What Class Is The Top Of The Awt Event Hierarchy?

      Answer :

      The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy.

    44. Question 44. When A Thread Is Created And Started, What Is Its Initial State?

      Answer :

      A thread is in the ready state after it has been created and started.

    45. Question 45. Can An Anonymous Class Be Declared As Implementing An Interface And Extending A Class?

      Answer :

      An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

    46. Question 46. What Is The Immediate Superclass Of Menu?

      Answer :

      MenuItem.

    47. Question 47. What Is The Purpose Of Finalization?

      Answer :

      The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

    48. Question 48. Which Class Is The Immediate Superclass Of The Menucomponent Class?

      Answer :

      Object.

    49. Question 49. What Invokes A Thread's Run() Method?

      Answer :

      After a thread is started, via its start() method or that of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.

    50. Question 50. What Is The Difference Between The Boolean & Operator And The && Operator?

      Answer :

      If an expression 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 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 evaluation of the second operand is skipped.

    51. Question 51. Name Three Subclasses Of The Component Class.

      Answer :

      Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, or TextComponent.

    52. Question 52. What Is The Gregoriancalendar Class?

      Answer :

      The GregorianCalendar class provides support for traditional Western calendars.

    53. Question 53. Which Container Method Is Used To Cause A Container To Be Laid Out And Redisplayed?

      Answer :

      validate() method is used to cause a container to be laid out and redisplayed.

    54. Question 54. What Is The Purpose Of The Runtime Class?

      Answer :

      The purpose of the Runtime class is to provide access to the Java runtime system.

    55. Question 55. How Many Times May An Object's Finalize() Method Be Invoked By The Garbage Collector?

      Answer :

      An object's finalize() method may only be invoked once by the garbage collector.

    56. Question 56. What Is The Purpose Of The Finally Clause Of A Try-catch-finally Statement?

      Answer :

      The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.

    57. Question 57. What Is The Argument Type Of A Program's Main() Method?

      Answer :

      A program's main() method takes an argument of the String[] type.

    58. Question 58. Which Java Operator Is Right Associative?

      Answer :

      The = operator is right associative.

    59. Question 59. Can A Double Value Be Cast To A Byte?

      Answer :

      Yes, a double value can be cast to a byte.

    60. Question 60. What Must A Class Do To Implement An Interface?

      Answer :

      It must provide all of the methods in the interface and identify the interface in its implements clause.

    61. Question 61. What Method Is Invoked To Cause An Object To Begin Executing As A Separate Thread?

      Answer :

      The start() method of the Thread class is invoked to cause an object to begin executing as a separate thread.

    62. Question 62. Name Two Subclasses Of The Textcomponent Class.

      Answer :

      TextField and TextArea.

    63. Question 63. Which Containers May Have A Menubar?

      Answer :

      Frame.

    64. Question 64. How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?

      Answer :

      Commas are used to separate multiple statements within the initialization and iteration parts of a for statement.

    65. Question 65. What Is The Purpose Of The Wait(), Notify(), And Notifyall() Methods?

      Answer :

      The wait(), notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an object's wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods..

    66. Question 66. What Is An Abstract Method?

      Answer :

      An abstract method is a method whose implementation is deferred to a subclass.

    67. Question 67. How Are Java Source Code Files Named?

      Answer :

      A Java source code file takes the name of a public class or interface that is defined within the file. A source code file may contain at most one public class or interface. If a public class or interface is defined within a source code file, then the source code file must take the name of the public class or interface.

      If no public class or interface is defined within a source code file, then the file must take on a name that is different than its classes and interfaces. Source code files use the .java extension.

    68. Question 68. What Is The Relationship Between The Canvas Class And The Graphics Class?

      Answer :

      A Canvas object provides access to a Graphics object via its paint() method.

    69. Question 69. What Are The High-level Thread States?

      Answer :

      The high-level thread states are ready, running, waiting, and dead.

    70. Question 70. What Value Does Read() Return When It Has Reached The End Of A File?

      Answer :

      The read() method returns -1 when it has reached the end of a file.

    71. Question 71. Can A Byte Object Be Cast To A Double Value?

      Answer :

      No. An object cannot be cast to a primitive value.

    72. Question 72. What Is The Difference Between A Static And A Non-static Inner Class?

      Answer :

      A non-static inner class 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.

    73. Question 73. What Is The Difference Between The String And Stringbuffer Classes?

      Answer :

      String objects are constants. StringBuffer objects are not constants.

    74. Question 74. If A Variable Is Declared As Private, Where May The Variable Be Accessed?

      Answer :

      A private variable may only be accessed within the class in which it is declared.

    75. Question 75. What Is An Object's Lock And Which Object's Have Locks?

      Answer :

      An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a 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.

    76. Question 76. What Is The Dictionary Class?

      Answer :

      The Dictionary class provides the capability to store key-value pairs.

    77. Question 77. How Are The Elements Of A Borderlayout Organized?

      Answer :

      The elements of a BorderLayout are organized at the borders (North, South, East, and West) and the center of a container.

    78. Question 78. What Is The % Operator?

      Answer :

      It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand.

    79. Question 79. When Can An Object Reference Be Cast To An Interface Reference?

      Answer :

      An object reference be cast to an interface reference when the object implements the referenced interface.

    80. Question 80. What Is The Difference Between A Window And A Frame?

      Answer :

      The Frame class extends Window to define a main application window that can have a menu bar.

    81. Question 81. Which Class Is Extended By All Other Classes?

      Answer :

      The Object class is extended by all other classes.

    82. Question 82. Can An Object Be Garbage Collected While It Is Still Reachable?

      Answer :

      A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected..

    83. Question 83. Is The Ternary Operator Written X : Y ? Z Or X ? Y : Z ?

      Answer :

      It is written x ? y : z.

    84. Question 84. What Is The Difference Between The Font And Fontmetrics Classes?

      Answer :

      The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.

    85. Question 85. How Is Rounding Performed Under Integer Division?

      Answer :

      The fractional part of the result is truncated. This is known as rounding toward zero.

    86. Question 86. What Happens When A Thread Cannot Acquire A Lock On An Object?

      Answer :

      If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.

    87. Question 87. What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?

      Answer :

      The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.

    88. Question 88. What Classes Of Exceptions May Be Caught By A Catch Clause?

      Answer :

      A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.

    89. Question 89. If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?

      Answer :

      A 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.

    90. Question 90. What Is The Simpletimezone Class?

      Answer :

      The SimpleTimeZone class provides support for a Gregorian calendar.

    91. Question 91. What Is The Map Interface?

      Answer :

      The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.

    92. Question 92. Does A Class Inherit The Constructors Of Its Superclass?

      Answer :

      A class does not inherit constructors from any of its superclasses.

    93. Question 93. For Which Statements Does It Make Sense To Use A Label?

      Answer :

      The only statements for which it makes sense to use a label are those statements that can enclose a break or continue statement.

    94. Question 94. What Is The Purpose Of The System Class?

      Answer :

      The purpose of the System class is to provide access to system resources.

    95. Question 95. Which Textcomponent Method Is Used To Set A Textcomponent To The Read-only State?

      Answer :

      setEditable().

    96. Question 96. How Are The Elements Of A Cardlayout Organized?

      Answer :

      The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.

    97. Question 97. Is &&= A Valid Java Operator?

      Answer :

      No. It is not a valid java operator.

    98. Question 98. Name The Eight Primitive Java Types.

      Answer :

      The eight primitive types are byte, char, short, int, long, float, double, and boolean.

    99. Question 99. Which Class Should You Use To Obtain Design Information About An Object?

      Answer :

      The Class class is used to obtain information about an object's design.

    100. Question 100. What Is The Relationship Between Clipping And Repainting?

      Answer :

      When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.

    101. Question 101. Is "abc" A Primitive Value?

      Answer :

      The String literal "abc" is not a primitive value. It is a String object.

    102. Question 102. What Is The Relationship Between An Event-listener Interface And An Event-adapter Class?

      Answer :

      An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event.

      An event adapter provides a default implementation of an event-listener interface.

    103. Question 103. What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?

      Answer :

      During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

    104. Question 104. What Modifiers May Be Used With An Interface Declaration?

      Answer :

      An interface may be declared as public or abstract.

    105. Question 105. Is A Class A Subclass Of Itself?

      Answer :

      A class is a subclass of itself.

    106. Question 106. What Is The Highest-level Event Class Of The Event-delegation Model?

      Answer :

      The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.

    107. Question 107. What Event Results From The Clicking Of A Button?

      Answer :

      The ActionEvent event is generated as the result of the clicking of a button.

    108. Question 108. How Can A Gui Component Handle Its Own Events?

      Answer :

      A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

    109. Question 109. How Are The Elements Of A Gridbaglayout Organized?

      Answer :

      The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.

    110. Question 110. What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?

      Answer :

      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.

    111. Question 111. What Is The Collection Interface?

      Answer :

      The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.

    112. Question 112. What Modifiers Can Be Used With A Local Inner Class?

      Answer :

      A local inner class may be final or abstract.

    113. Question 113. What Is The Difference Between Static And Non-static Variables?

      Answer :

      A static variable is associated with the class as a whole rather than with specific instances of a class.

      Non-static variables take on unique values with each object instance.

    114. Question 114. What Is The Difference Between The Paint() And Repaint() Methods?

      Answer :

      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.

    115. Question 115. What Is The Purpose Of The File Class?

      Answer :

      The File class is used to create objects that provide access to the files and directories of a local file system.

    116. Question 116. Can An Exception Be Rethrown?

      Answer :

      Yes, an exception can be rethrown.

    117. Question 117. Which Math Method Is Used To Calculate The Absolute Value Of A Number?

      Answer :

      The abs() method is used to calculate absolute values.

    118. Question 118. How Does Multithreading Take Place On A Computer With A Single Cpu?

      Answer :

      The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

    119. Question 119. When Does The Compiler Supply A Default Constructor For A Class?

      Answer :

      The compiler supplies a default constructor for a class if no other constructors are provided.

    120. Question 120. When Is The Finally Clause Of A Try-catch-finally Statement Executed?

      Answer :

      The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.

    121. Question 121. Which Class Is The Immediate Superclass Of The Container Class?

      Answer :

      Component.

    122. Question 122. If A Method Is Declared As Protected, Where May The Method Be Accessed?

      Answer :

      A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.

    123. Question 123. How Can The Checkbox Class Be Used To Create A Radio Button?

      Answer :

      By associating Checkbox objects with a CheckboxGroup.

    124. Question 124. Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?

      Answer :

      The non-Unicode letter characters $ and _ may appear as the first character of an identifier

    125. Question 125. What Restrictions Are Placed On Method Overloading?

      Answer :

      Two methods may not have the same name and argument list but different return types.

    126. Question 126. What Happens When You Invoke A Thread's Interrupt Method While It Is Sleeping Or Waiting?

      Answer :

      When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.

    127. Question 127. What Is Casting?

      Answer :

      There are two types of casting, casting between primitive numeric types and casting between object references.

      Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values.

      Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.

    128. Question 128. What Is The Return Type Of A Program's Main() Method?

      Answer :

      A program's main() method has a void return type.

    129. Question 129. Name Four Container Classes.

      Answer :

      Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane.

    130. Question 130. What Is The Difference Between A Choice And A List?

      Answer :

      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.

    131. Question 131. What Class Of Exceptions Are Generated By The Java Run-time System?

      Answer :

      The Java runtime system generates RuntimeException and Error exceptions.

    132. Question 132. What Class Allows You To Read Objects Directly From A Stream?

      Answer :

      The ObjectInputStream class supports the reading of objects from input streams.

    133. Question 133. What Is The Difference Between A Field Variable And A Local Variable?

      Answer :

      A field variable is a variable that is declared as a member of a class.

      A local variable is a variable that is declared local to a method.

    134. Question 134. Under What Conditions Is An Object's Finalize() Method Invoked By The Garbage Collector?

      Answer :

      The garbage collector invokes an object's finalize() method when it detects that the object has become unreachable.

    135. Question 135. What Is The Relationship Between A Method's Throws Clause And The Exceptions That Can Be Thrown During The Method's Execution?

      Answer :

      A method's throws clause must declare any checked exceptions that are not caught within the body of the method.

    136. Question 136. What Is The Difference Between The Jdk 1.02 Event Model And The Event-delegation Model Introduced With Jdk 1.1?

      Answer :

      The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model, components are required to handle their own events. If they do not handle a particular event, the event is inherited by (or bubbled up to) the component's container. The container then either handles the event or it is bubbled up to its container and so on, until the highest-level container has been tried.

      In the event-delegation model, specific objects are designated as event handlers for GUI components. These objects implement event-listener interfaces. The event-delegation model is more efficient than the event-inheritance model because it eliminates the processing required to support the bubbling of unhandled events.

    137. Question 137. How Is It Possible For Two String Objects With Identical Values Not To Be Equal Under The == Operator?

      Answer :

      The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory.

    138. Question 138. Why Are The Methods Of The Math Class Static?

      Answer :

      So they can be invoked as if they are a mathematical code library.

    139. Question 139. What Checkbox Method Allows You To Tell If A Checkbox Is Checked?

      Answer :

      getState().

    140. Question 140. What State Is A Thread In When It Is Executing?

      Answer :

      An executing thread is in the running state.

    141. Question 141. What Are The Legal Operands Of The Instanceof Operator?

      Answer :

      The left operand is an object reference or null value and the right operand is a class, interface, or array type.

    142. Question 142. What An I/o Filter?

      Answer :

      An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

    143. Question 143. If An Object Is Garbage Collected, Can It Become Reachable Again?

      Answer :

      Once an object is garbage collected, it ceases to exist. It can no longer become reachable again.

    144. Question 144. What Is The Set Interface?

      Answer :

      The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.

    145. Question 145. What Classes Of Exceptions May Be Thrown By A Throw Statement?

      Answer :

      A throw statement may throw any expression that may be assigned to the Throwable type.

    146. Question 146. What Are E And Pi?

      Answer :

      E is the base of the natural logarithm and PI is mathematical value pi.

    147. Question 147. Are True And False Keywords?

      Answer :

      The values true and false are not keywords.

    148. Question 148. What Is A Void Return Type?

      Answer :

      A void return type indicates that a method does not return a value.

    149. Question 149. What Is The Purpose Of The Enableevents() Method?

      Answer :

      The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event.

      The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.

    150. Question 150. What Is The Difference Between The File And Randomaccessfile Classes?

      Answer :

      The File class encapsulates the files and directories of the local file system.

      The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.

    151. Question 151. What Happens When You Add A Double Value To A String?

      Answer :

      The result is a String object.

    152. Question 152. What Is Your Platform's Default Character Encoding?

      Answer :

      If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1.

    153. Question 153. Which Package Is Always Imported By Default?

      Answer :

      The java.lang package is always imported by default.

    154. Question 154. What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?

      Answer :

      An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.

    155. Question 155. How Are This And Super Used?

      Answer :

      this is used to refer to the current object instance.

      super is used to refer to the variables and methods of the superclass of the current object instance.

    156. Question 156. What Is A Compilation Unit?

      Answer :A compilation unit is a Java source code file.

    157. Question 157. What Interface Is Extended By Awt Event Listeners?

      Answer :

      All AWT event listeners extend the java.util.EventListener interface.

    158. Question 158. What Restrictions Are Placed On Method Overriding?

      Answer :

      Overridden methods must have the same name, argument list, and return type.

      The overriding method may not limit the access of the method it overrides.

      The overriding method may not throw any exceptions that may not be thrown by the overridden method.

    159. Question 159. How Can A Dead Thread Be Restarted?

      Answer :

      A dead thread cannot be restarted.

    160. Question 160. What Happens If An Exception Is Not Caught?

      Answer :

      An uncaught exception results in the uncaughtException() method of the thread's ThreadGroup being invoked, which eventually results in the termination of the program in which it is thrown.

    161. Question 161. What Is A Layout Manager?

      Answer :A layout manager is an object that is used to organize components in a container.

    162. Question 162. Which Arithmetic Operations Can Result In The Throwing Of An Arithmeticexception?

      Answer :

      Integer / and % can result in the throwing of an ArithmeticException.

    163. Question 163. What Are Three Ways In Which A Thread Can Enter The Waiting State?

      Answer :

      A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.

    164. Question 164. Can An Abstract Class Be Final?

      Answer :

      An abstract class may not be declared as final.

    165. Question 165. What Is The Resourcebundle Class?

      Answer :

      The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.

    166. Question 166. What Happens If A Try-catch-finally Statement Does Not Have A Catch Clause To Handle An Exception That Is Thrown Within The Body Of The Try Statement?

      Answer :

      The exception propagates up to the next higher level try-catch statement (if any) or results in the program's termination.

    167. Question 167. What Is Numeric Promotion?

      Answer :

      Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place. In numerical promotion, byte, char, and short values are converted to int values. The int values are also converted to long values, if necessary. The long and float values are converted to double values, as required.

    168. Question 168. What Is The Difference Between A Scrollbar And A Scrollpane?

      Answer :

      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.

    169. Question 169. What Is The Difference Between A Public And A Non-public Class?

      Answer :

      A public class may be accessed outside of its package.

      A non-public class may not be accessed outside of its package.

    170. Question 170. To What Value Is A Variable Of The Boolean Type Automatically Initialized?

      Answer :

      The default value of the boolean type is false.

    171. Question 171. Can Try Statements Be Nested?

      Answer :

      Try statements may be tested.

    172. Question 172. What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator?

      Answer :

      The prefix form performs the increment operation and returns the value of the increment operation.

      The postfix form returns the current value all of the expression and then performs the increment operation on that value.

    173. Question 173. What Is The Purpose Of A Statement Block?

      Answer :

      A statement block is used to organize a sequence of statements as a single statement group.

    174. Question 174. What Is A Java Package And How Is It Used?

      Answer :

      A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces.

      Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.

    175. Question 175. What Modifiers May Be Used With A Top-level Class?

      Answer :

      A top-level class may be public, abstract, or final.

    176. Question 176. What Are The Object And Class Classes Used For?

      Answer :

      The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfaces that are loaded by a Java program..

    177. Question 177. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception?

      Answer :

      When an exception is thrown within the body of a try statement, the catch clauses of the try statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.

    178. Question 178. Can An Unreachable Object Become Reachable Again?

      Answer :

      An unreachable object may become reachable again. This can happen when the object's finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable objects.

    179. Question 179. When Is An Object Subject To Garbage Collection?

      Answer :

      An object is subject to garbage collection when it becomes unreachable to the program in which it is used.

    180. Question 180. What Method Must Be Implemented By All Threads?

      Answer :

      All tasks must implement the run() method, whether they are a subclass of Thread or implement the Runnable interface.

    181. Question 181. What Methods Are Used To Get And Set The Text Label Displayed By A Button Object?

      Answer :

      getLabel() and setLabel().

    182. Question 182. Which Component Subclass Is Used For Drawing And Painting?

      Answer :

      Canvas.

    183. Question 183. What Are Synchronized Methods And Synchronized Statements?

      Answer :

      Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class.

      Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.

    184. Question 184. What Are The Two Basic Ways In Which Classes That Can Be Run As Threads May Be Defined?

      Answer :

      A thread class may be declared as a subclass of Thread, or it may implement the Runnable interface.

    185. Question 185. What Are The Problems Faced By Java Programmers Who Don't Use Layout Managers?

      Answer :

      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.

    186. Question 186. What's Java Swing?

      Answer :

      Swing is basscially a type of Toolkit which is GUI toolkit for Java. It is one part of the Java Foundation Classes (JFC). Swing includes graphical user interface (GUI) widgets such as text boxes, buttons, split-panes, and tables.
      Swing widgets provide more sophisticated GUI components than the earlier Abstract Window Toolkit. Since they are written in pure Java, they run the same on all platforms, unlike the AWT which is tied to the underlying platform's windowing system. Swing supports pluggable look and feel � not by using the native platform's facilities, but by roughly emulating them. This means you can get any supported look and feel on any platform. The disadvantage of lightweight components is slower execution. The advantage is uniform behavior on all platforms.

    187. Question 187. What Is Jfc?

      Answer :

      JFC stands for Java Foundation Classes. The Java Foundation Classes (JFC) are a set of Java class libraries provided as part of Java 2 Platform, Standard Edition (J2SE) to support building graphics user interface (GUI) and graphics functionality for client applications that will run on popular platforms such as Microsoft Windows, Linux, and Mac OSX

    188. Question 188. What Is Awt?

      Answer :

      AWT is bassically stands for Abstract Window Toolkit. AWT enables programmers to develop Java applications with GUI components, such as windows, and buttons. The Java Virtual Machine (JVM) is responsible for translating the AWT calls into the appropriate calls to the host operating system.

    189. Question 189. What Are The Differences Between Swing And Awt?

      Answer :

      Many diff are there :
      > AWT is heavy-weight components, but Swing is light-weight components.
      > AWT is OS dependent because it uses native components, But Swing components are OS independent.
      > We can change the look and feel in Swing which is not possible in AWT.
      > Swing takes less memory compared to AWT.
      > For drawing AWT uses screen rendering where Swing uses double buffering.

    190. Question 190. What Are Heavy Weight Components ?

      Answer :

      A Heavyweight component is bassically associated with its own native screen resource which is generally known as a peer.

    191. Question 191. What Is Lightweight Component?

      Answer :

      A Lightweight component is the bassically one that "borrows" the screen resource of an ancestor , which means it has no native resource of its own -- so it's "lighter".

    192. Question 192. What Is Double Buffering ?

      Answer :

      Double buffering is bassically the process of use of two buffers rather than one to temporarily hold data being moved to and from an I/O device. Double buffering increases data transfer speed because one buffer can be filled while the other is being emptied.

    193. Question 193. What Is An Event In Swing?

      Answer :

      Event is basscially as Changing the state of an object is called an event.

    194. Question 194. What Is An Event Handler In Swing?

      Answer :

      An Event handler is bassically a part of a computer program created to tell the program how to act in response to a specific event.

    195. Question 195. Give Us The Name Of The List Layoutmanagers In Java?

      Answer :

      List is here :
      > Flow Layout Manager
      > Grid Layout Manager
      > Box Layout Manager
      > Border Layout Manager
      > Card Layout Manager
      > GridBag Layout Manager.

    196. Question 196. Difference B/w Paint() And Paintcomponent()?

      Answer :

      The Key point is that the paint() method invokes three methods in the following order :
      > PaintComponent()
      > paintBorder()
      > paintChildren()
      As a general rule, in Swing, we should be overriding the paintComponent method unless we know what we are doing paintComponent() paints only component (panel) but paint() paints component and all its children.

    197. Question 197. What Is The Relationship B/w The Canvas Class And The Graphics Class?

      Answer :

      A Canvas object provides access to a graphics object via its paint() method.

    198. Question 198. When Should The Method Invokelater() Be Used?

      Answer :

      This method is used to ensure that Swing components are updated through the event-dispatching thread.

    199. Question 199. What Is A Convertor?

      Answer :

      Converter is bassically an application that converts distance measurements between metric and U.S units.

    200. Question 200. What Is The Difference Between Jfc & Wfc?

      Answer :

      JFC supports robust and portable user interfaces. The Swing classes are robust, compatible with AWT, and provide you with a great deal of control over a user interface. Since source code is available, it is relatively easy to extend the JFC to do exactly what you need it to do. But the number of third-party controls written for Swing is still relatively small.
      WFC runs only on the Windows (32-bit) user interface, and uses Microsoft extensions to Java for event handling and ActiveX integration. Because ActiveX components are available to WFC programs, there are theoretically more controls available for WFC than for JFC. In practice, however, most ActiveX vendors do not actively support WFC, so the number of controls available for WFC is probably smaller than for JFC. The WFC programming model is closely aligned with the Windows platform.

    201. Question 201. What Is Struts?

      Answer :

      Struts is a web page development framework and an open source software that helps developers build web applications quickly and easily. Struts combines Java Servlets, Java Server Pages, custom tags, and message resources into a unified framework. It is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone between.

    202. Question 202. How Is The Mvc Design Pattern Used In Struts Framework?

      Answer :

      In the MVC design pattern, application flow is mediated by a central Controller. The Controller delegates requests to an appropriate handler. The handlers are tied to a Model, and each handler acts as an adapter between the request and the Model. The Model represents, or encapsulates, an application's business logic or state. Control is usually then forwarded back through the Controller to the appropriate View. The forwarding can be determined by consulting a set of mappings, usually loaded from a database or configuration file. This provides a loose coupling between the View and Model, which can make an application significantly easier to create and maintain. Controller--Servlet controller which supplied by Struts itself; View --- what you can see on the screen, a JSP page and presentation components; Model --- System state and a business logic JavaBeans.

    203. Question 203. Who Makes The Struts?

      Answer :

      Struts is hosted by the Apache Software Foundation(ASF) as part of its Jakarta project, like Tomcat, Ant and Velocity.

    204. Question 204. Why It Called Struts?

      Answer :

      Because the designers want to remind us of the invisible underpinnings that hold up our houses, buildings, bridges, and ourselves when we are on stilts. This excellent description of Struts reflect the role the Struts plays in developing web applications.

    205. Question 205. Do We Need To Pay The Struts If Being Used In Commercial Purpose?

      Answer :

      No. Struts is available for commercial use at no charge under the Apache Software License. You can also integrate the Struts components into your own framework just as if they were written in house without any red tape, fees, or other hassles.

    206. Question 206. What Are The Core Classes Of Struts?

      Answer :

      Action, ActionForm, ActionServlet, ActionMapping, ActionForward are basic classes of Structs.

    207. Question 207. What Is The Design Role Played By Struts?

      Answer :

      The role played by Structs is controller in Model/View/Controller(MVC) style. The View is played by JSP and Model is played by JDBC or generic data source classes. The Struts controller is a set of programmable components that allow developers to define exactly how the application interacts with the user.

    208. Question 208. How Struts Control Data Flow?

      Answer :

      Struts implements the MVC/Layers pattern through the use of ActionForwards and ActionMappings to keep control-flow decisions out of presentation layer.

    209. Question 209. What Configuration Files Are Used In Struts?

      Answer :

      ApplicationResources.properties
      struts-config.xml
      These two files are used to bridge the gap between the Controller and the Model.

    210. Question 210. What Helpers In The Form Of Jsp Pages Are Provided In Struts Framework?

      Answer :

      --struts-html.tld
      --struts-bean.tld
      --struts-logic.tld

    211. Question 211. Is Struts Efficient?

      Answer :

      The Struts is not only thread-safe but thread-dependent(instantiates each Action once and allows other requests to be threaded through the original object.
      ActionForm beans minimize subclass code and shorten subclass hierarchies.
      The Struts tag libraries provide general-purpose functionality.
      The Struts components are reusable by the application.
      The Struts localization strategies reduce the need for redundant JSPs.
      The Struts is designed with an open architecture--subclass available.
      The Struts is lightweight (5 core packages, 5 tag libraries).
      The Struts is open source and well documented (code to be examined easily).
      The Struts is model neutral.

    212. Question 212. How You Will Enable Front-end Validation Based On The Xml In Validation.xml?

      Answer :

      The < html:javascript > tag to allow front-end validation based on the xml in validation.xml. For example the code: < html:javascript formName=logonForm dynamicJavascript=true staticJavascript=true / > generates the client side java script for the form logonForm as defined in the validation.xml file. The < html:javascript > when added in the jsp file generates the client site validation script.

    213. Question 213. What Is Actionservlet?

      Answer :

      The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.

    214. Question 214. How You Will Make Available Any Message Resources Definitions File To The Struts Framework Environment?

      Answer :

      Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through < message-resources / > tag. Example: < message-resources parameter= MessageResources / >

    215. Question 215. What Is Action Class?

      Answer :

      The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.

    216. Question 216. Write Code Of Any Action Class?

      Answer :

      Here is the code of Action Class that returns the ActionForward object. 
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import org.apache.struts.action.Action;
      import org.apache.struts.action.ActionForm;
      import org.apache.struts.action.ActionForward;
      import org.apache.struts.action.ActionMapping; 
      public class TestAction extends Action
      {
      public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) throws Exception
      {
      return mapping.findForward(\"testAction\");
      }
      }

    217. Question 217. What Is Actionform?

      Answer :

      An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.

    218. Question 218. What Is Struts Validator Framework?

      Answer :

      Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class. The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.

    219. Question 219. Give The Details Of Xml Files Used In Validator Framework?

      Answer :

      The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean. How you will display validation fail errors on jsp page? - The following tag displays all the errors: < html:errors/ >

    220. Question 220. Why Do We Need Struts?

      Answer :

      Java technologies give developers a serious boost when creating and maintaining applications to meet the demands of today's public Web sites and enterprise intranets. Struts combines Java Servlets, Java ServerPages, custom tags, and message resources into a unified framework. The end result is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone in between.

    221. Question 221. How Does Struts Work?

      Answer :

      Java Servlets are designed to handle requests made by Web browsers. Java ServerPages are designed to create dynamic Web pages that can turn billboard sites into live applications. Struts uses a special Servlet as a switchboard to route requests from Web browsers to the appropriate ServerPage. This makes Web applications much easier to design, create, and maintain.

    222. Question 222. Is Struts Compatible With Other Java Technologies?

      Answer :

      Yes. Struts is committed to supporting industry standards. Struts acts as an integrator of Java technologies so that they can be used in the "real world".

    223. Question 223. Who Wrote Struts?

      Answer :

      There are several active committers to the Struts project, working cooperatively from around the globe. Dozens of individual developers and committers contributed to the Struts 1.x codebase. All interested Java developers are invited to contribute to the project. Struts is a Apache Software Foundation project, with the mission to "provide secure, enterprise-grade server solutions based on the Java Platform that are developed in an open and cooperative fashion". 

      Struts was created by Craig R. McClanahan and donated to The Apache Software Foundation in May 2000. Craig was the primary developer of both Struts 1.x and Tomcat 4. Tomcat 4 was the basis for the official reference implementation for a servlet 2.3 and JSP 1.2 container. 

      Craig's current focus is as architect of the Sun Java Studio Creator (formerly Project Rave). Craig also serves as the Specification Lead for JavaServer Faces (JSR-127), and is the Web Layer Architect for the Java2 Enterprise Edition (J2EE) platform as a whole. 

    224. Question 224. Why Is It Called Struts?

      Answer :

      It's a reference to struts in the architectural sense, a reminder of the nearly invisible pieces that hold up buildings, houses, and bridges.

    225. Question 225. Do I Have To Credit Struts On My Own Website?

      Answer :

      You need to credit Struts if you redistribute your own framework based on Struts for other people to use. (See the Apache License for details.) But you do not need to credit Struts just because your web application utilizes the framework. It's the same situation as using the Apache HTTPD server or Tomcat. Not required if its just running your web site.

    226. Question 226. Where Can I Get A Copy Of Struts?

      Answer :

      The best place to download Struts is at struts.apache.org. The nightly builds are very stable, and recommended as the best place to start today.

    227. Question 227. How Do I Install Struts?

      Answer :

      To develop applications with Struts, you can usually just add the Struts JAR file to your Java development environment. You can then start using the Struts classes as part of your own application. A blank Struts application (in the webapps directory, open struts-blank.war) is provided, which you can just copy to get a quick-start on your own brainchild. 

      Since the full source code for Struts is available, we also provide complete instructions for compiling your own Struts JAR from scratch. (This is actually easier than it looks!) 

      Your Struts application can usually be deployed using a standard WAR file. In most cases, you simply deposit the WAR file on your application server, and it is installed automatically. If not, step-by-step installation instructions for various servlet containers are available.

    228. Question 228. When Do I Need "struts.jar" On My Classpath?

      Answer :

      When you are compiling an application that uses the Struts classes, you must have the "struts.jar" on the classpath your compiler sees -- it does not have to be on your CLASSPATH environment variable. 

      Why is that an important distinction? Because if you are using a servlet container on your development machine to test your application, the "struts.jar" must not be on your CLASSPATH environment variable when running the container. (This is because each Web application must also have their own copy of the Struts classes, and the container will become confused if it is on the environment path as well.) 

      There are several general approaches to this issue: 

      * Use ANT for building your projects -- it can easily assemble classpaths for the compiler. (This is how Struts itself is built, along with Tomcat and most other Java-based projects).
      * Use an IDE where you can configure the "class path" used for compilation independent of the CLASSPATH environment variable.
      * Use a shell script that temporarily adds struts.jar to the classpath just for compilation, for example javac -classpath /path/to/struts.jar:$CLASSPATH [email protected]

    229. Question 229. Does Struts Include Its Own Unit Tests?

      Answer :

      Struts currently has two testing environments, to reflect the fact that some things can be tested statically, and some really need to be done in the environment of a running servlet container.

      For static unit tests, we use the JUnit framework. The sources for these tests are in the "src/test" hierarchy in the source repository, and are executed via the "test.junit" target in the top-level build.xml file. Such tests are focused on the low-level functionality of individual methods, are particularly suitable for the static methods in the org.apache.struts.util utility classes. In the test hierarchy, there are also some "mock object" classes (in the org.apache.struts.mock package) so that you can package up things that look like servlet API and Struts API objects to pass in as arguments to such tests.

      Another valuable tool is Struts TestCase which provides a useful harness for Action classes that can be used with JUnit or Cactus.

    230. Question 230. If The Framework Doesn't Do What I Want, Can I Request That A Feature Be Added?

      Answer :

      First, it's important to remember that Struts is an all-volunteer project. We don't charge anyone anything to use Struts. Committers and other developers work on Struts because they need to use it with their own applications. If others can use it too, that's "icing on the cake". If you submit a patch for a feature that a Committer finds useful, then that Committer may choose to volunteer his or her time to apply the patch. If you just submit an idea without a patch, it is much less likely to be added (since first someone else has to volunteer their time to write the patch). 

      We are grateful for any patches, and we welcome new ideas, but the best way to see that something gets added to the framework is to do as much of the work as you can, rather than rely on the "kindness of strangers". Worst case, you can apply the patch to your copy of Struts and still use the feature in your own application. (Which is what open source is really all about.)

    231. Question 231. Where Can I Get Help With Struts?

      Answer :

      The Struts package comes complete with a Users Guide to introduce people to the framework and its underlying technologies. Various components also have their own in-depth Developers Guide, to cover more advanced topics. Comprehensive Javadocs are included along with the full source code. For your convenience, these are bundled together as a self-installing application. The struts-documentation.war is the same bundle that is deployed as the Struts Web site.

      The Strut's mailing list is also very active, and welcomes posts from new users. Before posting a new question, be sure to consult the MAILING LIST ARCHIVE and the very excellent How To Ask Questions The Smart Way by Eric Raymond. Please do be sure to turn off HTML in your email client before posting.

    232. Question 232. What's The Difference Between Struts And Turbine? What's The Difference Between Struts And Espresso?

      Answer :

      If you are starting from scratch, packages like Turbine and Espresso can be very helpful since they try to provide all of the basic services that your team is likely to need. Such services include things like data persistence and logging. 

      If you are not starting from scratch, and need to hook up your web application to an existing infrastructure, then "plain vanilla" Struts can be a better choice. The core Struts framework does not presuppose that you are using a given set of data persistence, presentation, or logging tools. Anything goes =:0) 

      Compared to other offerings, Struts endeavors to be a minimalist framework. We try leverage existing technologies whenever we can and provide only the missing pieces you need to combine disparate technologies into a coherent application. This is great when you want to select your own tools to use with Struts. But, if you prefer a more integrated infrastructure, then packages like Turbine or Espresso (which uses Struts) are perfectly good ways to go.

      See also

      * < http://www.mail-archive.com/[email protected]/msg03206.html >
      * < http://www.mail-archive.com/[email protected]/msg00495.html >
      * < http://jakarta.apache.org/velocity/ymtd/ymtd.html >

    233. Question 233. Why Aren't The Struts Tags Maintained As Part Of The Jakarta Taglibs Project ?

      Answer :

      Development of both products began about the same time. Leading up to the release of 1.0, it was thought better to continue to develop the taglibs alongside the controller. Now that 1.0 is out, the JavaServer Pages Standard Taglib is in active development. Once work on JSTL stabilizes, the Struts taglibs will be revisited. Tags which are not linked directly to the framework may be hosted at Jakarta Taglibs instead.

    234. Question 234. Are The Struts Tags Xhtml Compliant ?

      Answer :

      If you use an <html:html xhtml="true> or <html:xhtml/> element on your page, the tags will render as XHTML (since Struts 1.1).

    235. Question 235. Will The Struts Tags Support Other Markup Languages Such As Wml ?

      Answer :

      Struts itself is markup neutral. The original Struts taglibs are only one example of how presentation layer components can access the framework. The framework objects are exposed through the standard application, session, and request contexts, where any Java component in the application can make use of them.

      Markup extensions that use Struts are available for Velocity and XLST, among others. A new Struts tag library for Java Server Faces is also in development.

      For more about using WAP/WML with Struts see the article WAP up your EAserver.

    236. Question 236. What About Jstl And Javaserver Faces ?

      Answer :

      JSTL, the JavaServer Standard Tag Library, is a set of JSP tags that are designed to make it easier to develop Web applications. JavaServer Faces (JSF) is a specification for a new technology that promises to make it easier to write MVC applications, both for the Web and for the desktop. 

      The inventor of Struts, Craig McClanahan, is the specification co-lead for JavaServer Faces (JSR 127), and architect of the reference implemenation as well as Java Studio Creator. Both JSTL and JSF are complementary to Struts. 

      The mainstay of the Struts framework is the controller components, which can be used with any Java presentation technology. As new technologies become available, it is certain that new "glue" components will also appear to help these technologies work as well with Struts.

      Struts originally came bundled with a set of custom JSP tags. Today, several extensions are available to help you use Struts with other popular presentation technologies, like XSLT and Velocity. Likewise, extensions for JSTL and JSF are now available as well. 

      The JSTL reference implementation is available through the Jakarta Taglibs site. A JSTL taglibs for Struts, Struts-El , is available and distributed with Struts beginning with the 1.1 release. 

      The JSF specification and reference implementation is available through Sun's The JSF specification and reference implementation is available through Sun's Java ServerFaces page. An early-release JavaServer Faces taglib for Struts, Struts-Faces, is also in early release and available through the nightly build. The Struts Faces taglib is expected to work with any compliant JSF implementation, including MyFaces.

    237. Question 237. Is There A Particularly Good Ide To Use With Struts?

      Answer :

      Struts should work well with any development environment that you would like to use, as well as with any programmers editor. The members of the Struts development team each use their own tools such as Emacs, IDEA, Eclipse, and NetBeans.

    238. Question 238. Why Was Reload Removed From Struts (since 1.1)?

      Answer :

      The problem with ReloadAction was that Struts was trying to act like a container, but it couldn't do a proper job of it. For example, you can't reload classes that have been modified, or (portably) add new classes to a running web application (even if the container supported it). 

      Meanwhile, as Struts 1.1 was being developed, work progressed on things like Tomcat's reload command via the Manager webapp. This feature allows you to quickly reload-on-demand, complete with saving and restoring your session). It started to make even less sense for Struts to half-implement a feature that containers are implementing fully.

      A more minor point is that freezing the configuration information at application startup time allows Struts to safely access the mapping information without bothering with synchronization. The "startup-only" strategy creates a modest but real improvement in performance for all users. 

      So, ReloadAction is not supported since Struts 1.1 for two reasons:

      * It never did let you reload everything that you would really want to -- particularly changed classes -- so many people ended up having to reload the webapp anyway.
      * Containers are starting to offer reload-on-demand features which does the same thing as the Struts ReloadAction, only better.
      * Not supporting ReloadAction lets Struts avoid doing synchronization locks around all the lookups (like figuring out which action to use, or the destination of an ActionForward) so applications can run a little faster.

      Of course, if someone came up with an implementation that solved these problems without creating any others, we would not be opposed to including a new ReloadAction.

    239. Question 239. What Is A Modular Application? What Does Module-relative Mean?

      Answer :

      Since Struts 1.1, the framework supports multiple application modules. All applications have at least one root, or default, module. Like the root directory in a file system, the default application has no name. (Or is named with an empty string, depending your viewpoint.) Developing an application with only a default module is no different from how applications were developed under Struts 1.0. Since Struts 1.1, you can add additional modules to your application, each of which can have their own configuration files, messages resources, and so forth. Each module is developed in the same way as the default module. Applications that were developed as a single module can added to a multiple module application, and modules can promoted to a standalone application without change. For more about configuring your application to support multiple modules, see Configuring Applications in the User Guide.

      But to answer the question =:0), a modular application is a Struts application that uses more than one module. Module-relative means that the URI starts at the module level, rather than at the context level, or the absolute-URL level. 

      * Absolute URL: http://localhost/myApplication/myModule/myAction.do
      * context-relative: /myModule/myAction.do
      * module-relative: /myAction.do
      The Struts Examples application is a modular application that was assembled from several applications that were created independently.

    240. Question 240. Why Are Some Of The Class And Element Names Counter-intuitive?

      Answer :

      The framework grew in the telling and, as it evolved, some of the names drifted. The good thing about a nightly build, is that everything becomes available to the community as soon as it is written. The bad thing about a nightly build is that things like class names get locked down early and then become difficult to change.

    241. Question 241. Why Is Actionform A Base Class Rather Than An Interface?

      Answer :

      The MVC design pattern is very simple to understand but much more difficult to live with. You just need this little bit of Business Logic in the View logic or you need just that little bit of View logic in the Business tier and pretty soon you have a real mess.

      Making ActionForm a class takes advantage of the single inheritance restriction of Java to it makes it more difficult for people to do things that they should not do.

      ActionForms implemented as interfaces encourage making the property types match the underlying business tier instead of Strings, which violates one of the primary purposes for ActionForms in the first place (the ability to reproduce invalid input, which is a fundamental user expectation). ActionForms as an interface would also encourage using existing DAO objects as ActionForms by adding implements ActionForm to the class. This violates the MVC design pattern goal of separation of the view and business logic. 

      Since the goal of struts is to enforce this separation, it just makes more sense for Struts to own the ActionForm. 

      DynaActionForms relieve developers of maintaining simple ActionForms. For near zero maintenance, try Niall Pemberton's LazyActionForm.

    242. Question 242. Do Actionforms Have To Be True Javabeans?

      Answer :

      The utilities that Struts uses (Commons-BeanUtils since 1.1) require that ActionForm properties follow the JavaBean patterns for mutators and accessors (get*,set*,is*). Since Struts uses the Introspection API with the ActionForms, some containers may require that all the JavaBean patterns be followed, including declaring "implements Serializable" for each subclass. The safest thing is to review the JavaBean specification and follow all the prescribed patterns.

      Since Struts 1.1, you can also use DynaActionForms and mapped-backed forms, which are not true JavaBeans. For more see ActionForm classes in the User Guide and Using Hashmaps with ActionForms in this FAQ.

    243. Question 243. Can I Use Multiple Html Form Elements With The Same Name?

      Answer :

      Yes. Define the element as an array and Struts will autopopulate it like any other. 
      private String[] id= {};
      public String[] getId() { return this.id; }
      public void setItem(String id[]) {this.id = id;}
      And so forth

    244. Question 244. Why Doesn't The Focus Feature On The Tag Work In Every Circumstance?

      Answer :

      Unfortunately, there is some disagreement between the various browsers, and different versions of the same browser, as to how the focus can be set. The <html:form> tag provides a quick and easy JavaScript that will set the focus on a form for most versions of most browsers. If this feature doesn't work for you, then you should set the focus using your own JavaScript. The focus feature is a convenient "value-add" -- not a core requirement of the tag. If you do come up with a JavaScript that provides the final solution to this project, please post your patch to this Bugzilla ticket.

    245. Question 245. Why Are My Checkboxes Not Being Set From On To Off?

      Answer :

      A problem with a checkbox is that the browser will only include it in the request when it is checked. If it is not checked, the HTML specification suggests that it not be sent (i.e. omitted from the request). If the value of the checkbox is being persisted, either in a session bean or in the model, a checked box can never unchecked by a HTML form -- because the form can never send a signal to uncheck the box. The application must somehow ascertain that since the element was not sent that the corresponding value is unchecked. 

      The recommended approach for Struts applications is to use the reset method in the ActionForm to set all properties represented by checkboxes to null or false. The checked boxes submitted by the form will then set those properties to true. The omitted properties will remain false. Another solution is to use radio buttons instead, which always submit a value. 

      It is important to note that the HTML specification recommends this same behavior whenever a control is not "successful". Any blank element in a HTML form is not guaranteed to submitted. It is therefor very important to set the default values for an ActionForm correctly, and to implement the reset method when the ActionForm might kept in session scope.

    246. Question 246. Can't I Just Create Some Of My Javabeans In The Jsp Using A Scriptlet?

      Answer :

      Struts is designed to encourage a Model 2/MVC architecture. But there is nothing that prevents you from using Model 1 techniques in your JavaServer Pages, so the answer to the question is "Yes, you can". 

      Though, using Model 1 techniques in a Struts application does go against the grain. The approach recommended by most Struts developers is to create and populate whatever objects the view may need in the Action, and then forward these through the request. Some objects may also be created and stored in the session or context, depending on how they are used. 

      Likewise, there is nothing to prevent you from using scriptlets along with JSP tags in your pages. Though, many Struts developers report writing very complex scriplet-free applications and recommend the JSP tag approach to others. 

      For help with Model 1 techniques and scriptlets, you might consider joining the Javasoft JSP-interest mailing list, where there are more people still using these approaches.

    247. Question 247. Can I Use Javascript To Submit A Form?

      Answer :

      You can submit a form with a link as below. BTW, the examples below assume you are in an block and 'myForm' is picked up from the struts-config.xml name field of the action. 

      <a href='javascript:void(document.forms["myForm"].submit()>My Link</a> 
      Now the trick in the action is to decode what action you intend to perform. Since you are using JavaScript, you could set a field value and look for it in the request or in the form. 
      ... html/javascript part ... 
      <input type='hidden' value='myAction' />
      <input type='button' value='Save Meeeee'
      onclick='document.forms["myForm"].myAction.value="save";
      document.forms["myForm"].submit();' />
      <input type='button' value='Delete Meeeee'
      onclick='document.forms["myForm"].myAction.value="delete";
      document.forms["myForm"].submit();' />
      ... the java part ...
      class MyAction extends ActionForm implements Serializable {

      public ActionForward execute (ActionMapping map, ActionForm form,
      HttpServletRequest req, HttpServletResponse) {

      String myAction = req.getParameter("myAction");

      if (myAction.equals("save") {
      // ... save action ...
      } else if (myAction.equals("delete") {
      // ... delete action ...
      }
      }
      }
      }

      This is just one of many ways to achieve submitting a form and decoding the intended action. Once you get used to the framework you will find other ways that make more sense for your coding style and requirements. Just remember this example is completely non-functional without JavaScript.

    248. Question 248. How Can I Scroll Through List Of Pages Like The Search Results In Google?

      Answer :

      Many Struts developers use the Pager from the JSPTags site.
      http://jsptags.com/tags/navigation/pager/

    249. Question 249. Why Do The Struts Tags Provide For So Little Formatting?

      Answer :

      The Struts tags seem to provide only the most rudimentary functionality. Why is there not better support for date formatting and advanced string handling? 

      Three reasons: 

      First, work started on the JSTL and we didn't want to duplicate the effort. 
      Second, work started on Java Server Faces, and we didn't want to duplicate that effort either. 

      Third, in a Model 2 application, most of the formatting can be handled in the ActionForms (or in the business tier), so all the tag has to do is spit out a string. This leads to better reuse since the same "how to format" code does not need to be repeated in every instance. You can "say it once" in a JavaBean and be done with it. Why don't the Struts taglibs offer more layout options? 

      Since the Struts tags are open source, you can extend them to provide whatever additional formatting you may need. If you are interested in a pre-written taglib that offers more layout options, see the struts-layout taglib. 

      In the same arena, there is a well regarded contributor taglib that can help you create Menus for your Struts applications.

    250. Question 250. Why Does The Tag Url-encode Javascript And Mailto Links?

      Answer :

      The <html:link> tag is not intended for use with client-side references like those used to launch Javascripts or email clients. The purpose of link tag is to interject the context (or module) path into the URI so that your server-side links are not dependent on your context (or module) name. It also encodes the link, as needed, to maintain the client's session on the server. Neither feature applies to client-side links, so there is no reason to use the <html:link> tag. Simply markup the client-side links using the standard tag.

    251. Question 251. Why Does The Option Tag Render Selected=selected Instead Of Just Selected?

      Answer :

      Attribute minimization (that is, specifying an attribute with no value) is a place where HTML violates standard XML syntax rules. This matters a lot for people writing to browsers that support XHTML, where doing so makes the page invalid. It's much better for Struts to use the expanded syntax, which works the same on existing browsers interpreting HTML, and newer browsers that expect XHTML-compliant syntax. Struts is following the behavior recommended by the XHTML specification.

    252. Question 252. Do I Have To Use Jsps With My Application?

      Answer :

      The short answer to this question is: No, you are not limited to JavaServer Pages. 
      The longer answer is that you can use any type of presentation technology which can be returned by a web server or Java container. The list includes but is not limited to: 
      * JavaServer Pages,
      * HTML pages,
      * WML files,
      * Java servlets,
      * Velocity templates, and
      * XML/XLST
      Some people even mix and match apparently unrelated technologies, like PHP, into the same web application.

    253. Question 253. Can I Have An Action Without A Form?

      Answer :

      Yes. If your Action does not need any data and it does not need to make any data available to the view or controller component that it forwards to, it doesn't need a form. A good example of an Action with no ActionForm is the LogoffAction in the struts example application:

      <action path="/logoff"
      type="org.apache.struts.webapp.example.LogoffAction">
      <forward name="success" path="/index.jsp"/>
      </action>

      This action needs no data other than the user's session, which it can get from the Request, and it doesn't need to prepare any view elements for display, so it does not need a form.

      However, you cannot use the <html:form> tag without an ActionForm. Even if you want to use the <html:form> tag with a simple Action that does not require input, the tag will expect you to use some type of ActionForm, even if it is an empty subclass without any properties.

    254. Question 254. Can You Give Me A Simple Example Of Using The Requiredif Validator Rule?

      Answer :

      First off, there's an even newer Validator rule called validwhen, which is almost certainly what you want to use, since it is much easier and more powerful. It will be available in the first release after 1.1 ships. 
      The example shown below could be coded with validwhen as:

      <form name="medicalStatusForm">

      <field
      property="pregnancyTest" depends="validwhen">
      <arg0 key="medicalStatusForm.pregnancyTest.label"/>
      <var>
      <var-name>test</var-name>
      <var-value>((((sex == 'm') OR (sex == 'M')) 
      AND (*this* == null)) OR (*this* != null))</test>
      </var>
      </field>

      Let's assume you have a medical information form
      with three fields,
      sex, pregnancyTest, and testResult. If sex is 'f' or 'F', 
      pregnancyTest is required. If pregnancyTest is not blank, 
      testResult is required. The entry in your validation.xml 
      file would look like this:

      <form name="medicalStatusForm">

      <field
      property="pregnancyTest" depends="requiredif">
      <arg0 key="medicalStatusForm.pregnancyTest.label"/>
      <var>
      <var-name>field[0]</var-name>
      <var-value>sex</var-value>
      </var>
      <var>
      <var-name>fieldTest[0]</var-name>
      <var-value>EQUAL</var-value>
      </var>
      <var>
      <var-name>fieldValue[0]</var-name>
      <var-value>F</var-value>
      </var>
      <var>
      <var-name>field[1]</var-name>
      <var-value>sex</var-value>
      </var>
      <var>
      <var-name>fieldTest[1]</var-name>
      <var-value>EQUAL</var-value>
      </var>
      <var>
      <var-name>fieldValue[1]</var-name>
      <var-value>f</var-value>
      </var>
      <var>
      <var-name>fieldJoin</var-name>
      <var-value>OR</var-value>
      </var>
      </field>

      <field
      property="testResult" depends="requiredif">
      <arg0 key="medicalStatusForm.testResult.label"/>
      <var>
      <var-name>field[0]</var-name>
      <var-value>pregnancyTest</var-value>
      </var>
      <var>
      <var-name>fieldTest[0]</var-name>
      <var-value>NOTNULL</var-value>
      </var>
      </field>
      </form>

    255. Question 255. When Is The Best Time To Validate Input?

      Answer :

      This is an excellent question. Let's step back a second and think about a typical mid to large size application. If we start from the back end and work toward the view we have:
      1) Database: Most modern databases are going to validate for required fields, duplicate records, security constraints, etc. 
      2) Business Logic: Here you are going to check for valid data relationships and things that make sense for the particular problem you are triing to solve. 
      ... This is where struts comes into the picture, by now the system should be pretty well bulletproof. What we are going to do is make validation friendlier and informative. Rember it is OK to have duplicate validations... 
      3) ActionErrors validate(ActionMapping map, HttpServletRequest req) is where you can do your validation and feed back to the view, information required to correct any errors. validate is run after the form has been reset and after the ActionForm properties have been set from corresponding view based input. Also remember you can turn validation off with validate="false" in the action mapping in the struts-config.xml. This is done by returning an ActionErrors collection with messages from your ApplicationResources.properties file. 
      Here you have access to the request so you can see what kinds of action is being requested to fine tune your validations. The <html:error> tag allows you to dump all errors on your page or a particular error associated with a particular property. The input attribute of the struts-config.xml action allows you to send validation errors to a particular jsp / html / tile page. 
      4) You can have the system perform low level validations and client side feedback using a ValidatorForm or its derivatives. This will generate javascript and give instant feedback to the user for simple data entry errors. You code your validations in the validator-rules.xml file. A working knowledge of regular expressions is necessary to use this feature effectively.

    256. Question 256. How Can I Avoid Validating A Form Before Data Is Entered?

      Answer :

      The simplest way is to have two actions. The first one has the job of setting the form data, i.e. a blank registration screen. The second action in our writes the registration data to the database. Struts would take care of invoking the validation and returning the user to the correct screen if validation was not complete. 

      The EditRegistration action in the struts example application illustrates this: 

      < action path="/editRegistration">
      type="org.apache.struts.webapp.example.EditRegistrationAction"
      attribute="registrationForm"
      scope="request"
      validate="false">
      <forward name="success path="/registration.jsp"/>
      </action>

      When the /editRegistration action is invoked, a registrationForm is created and added to the request, but its validate method is not called. The default value of the validate attribute is true, so if you do not want an action to trigger form validation, you need to remember to add this attribute and set it to false.

    257. Question 257. Declarative Exception Handling

      Answer :

      If you have developed web applications long enough, you will realize a recurring pattern emerges: when the backend (e.g. the EJB tier) throws you an exception, you nearly always need to display an error page corresponding to the type of that exception. Sooner or later, you will come up with a mechanism to use a lookup table (e.g. an HashMap) to lookup an error page from the exception class. 

      Struts 1.1 now provides a similar but more powerful mechanism to declare exception handling. In Struts 1.1, you can declare in the struts-config.xml the associations between an exception class and an exception handler. Using the default exception handler included in Struts, you can also specify the path of the error pages. With this information, Struts will automatically forward to the specified pages when an uncaught exception is thrown from an Action. 

      Like other facilities in Struts, the exception handlers are pluggable. You can write and define your own handler classes if needed. 

    258. Question 258. What Is Hibernate?

      Answer :

      Hibernate is a powerful, high performance object/relational persistence and query service.

      This lets the users to develop persistent classes following object-oriented principles such as association, inheritance, polymorphism, composition, and collections.

    259. Question 259. What Is Orm?

      Answer :

      ORM stands for Object/Relational mapping. It is the programmed and translucent perseverance of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.

    260. Question 260. What Does An Orm Solution Comprises Of?

      Answer :

      • It should have an API for performing basic CRUD (Create, Read, Update, Delete) operations on objects of persistent classes. 
      • Should have a language or an API for specifying queries that refer to the classes and the properties of classes. 
      • An ability for specifying mapping metadata. 
      • It should have a technique for ORM implementation to interact with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions.

    261. Question 261. What Are The Different Levels Of Orm Quality?

      Answer :

      There are four levels defined for ORM quality.
      i. Pure relational
      ii. Light object mapping
      iii. Medium object mapping
      iv. Full object mapping.

    262. Question 262. What Is A Pure Relational Orm?

      Answer :

      The entire application, including the user interface, is designed around the relational model and SQL-based relational operations.

    263. Question 263. What Is A Meant By Light Object Mapping?

      Answer :

      The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of entities, or applications with common, metadata-driven data models. This approach is most known to all.

    264. Question 264. What Is A Meant By Medium Object Mapping?

      Answer :

      The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language. This is best suited for medium-sized applications with some complex transactions. Used when the mapping exceeds 25 different database products at a time. 

    265. Question 265. What Is Meant By Full Object Mapping?

      Answer :

      Full object mapping supports sophisticated object modeling: composition, inheritance, polymorphism and persistence. The persistence layer implements transparent persistence; persistent classes do not inherit any special base class or have to implement a special interface. Efficient fetching strategies and caching strategies are implemented transparently to the application. 

    266. Question 266. What Are The Benefits Of Orm And Hibernate?

      Answer :

      There are many benefits from these. Out of which the following are the most important one. 
      i. Productivity – Hibernate reduces the burden of developer by providing much of the functionality and let the developer to concentrate on business logic. 
      ii. Maintainability – As hibernate provides most of the functionality, the LOC for the application will be reduced and it is easy to maintain. By automated object/relational persistence it even reduces the LOC. 
      iii. Performance – Hand-coded persistence provided greater performance than automated one. But this is not true all the times. But in hibernate, it provides more optimization that works all the time there by increasing the performance. If it is automated persistence then it still increases the performance. 
      iv. Vendor independence – Irrespective of the different types of databases that are there, hibernate provides a much easier way to develop a cross platform application. 

    267. Question 267. How Does Hibernate Code Looks Like?

      Answer :

      Session session = getSessionFactory().openSession();
      Transaction tx = session.beginTransaction();
      MyPersistanceClass mpc = new MyPersistanceClass ("Sample App");
      session.save(mpc);
      tx.commit();
      session.close(); 
      The Session and Transaction are the interfaces provided by hibernate. There are many other interfaces besides this. 

    268. Question 268. What Is A Hibernate Xml Mapping Document And How Does It Look Like?

      Answer :

      In order to make most of the things work in hibernate, usually the information is provided in an xml document. This document is called as xml mapping document. The document defines, among other things, how properties of the user defined persistence classes’ map to the columns of the relative tables in database.

      <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC
      "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
      <hibernate-mapping>
      <class name="sample.MyPersistanceClass" table="MyPersitaceTable">
      <id name="id" column="MyPerId">          <generator class="increment"/>
      </id>
      <property name="text" column="Persistance_message"/>
      <many-to-one name="nxtPer" cascade="all" column="NxtPerId"/>
      </class>
      </hibernate-mapping> 
      Everything should be included under <hibernate-mapping> tag. This is the main tag for an xml mapping document. 

    269. Question 269. What The Core Interfaces Are Of Hibernate Framework?

      Answer :

      There are many benefits from these. Out of which the following are the most important one. 

      i. Session Interface – This is the primary interface used by hibernate applications. The instances of this interface are lightweight and are inexpensive to create and destroy. Hibernate sessions are not thread safe. 
      ii. SessionFactory Interface – This is a factory that delivers the session objects to hibernate application. Generally there will be a single SessionFactory for the whole application and it will be shared among all the application threads. 
      iii. Configuration Interface – This interface is used to configure and bootstrap hibernate. The instance of this interface is used by the application in order to specify the location of hibernate specific mapping documents. 
      iv. Transaction Interface – This is an optional interface but the above three interfaces are mandatory in each and every application. This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction.
      v. Query and Criteria Interface – This interface allows the user to perform queries and also control the flow of the query execution. 

    270. Question 270. What Are Callback Interfaces?

      Answer :

      These interfaces are used in the application to receive a notification when some object events occur. Like when an object is loaded, saved or deleted. There is no need to implement callbacks in hibernate applications, but they’re useful for implementing certain kinds of generic functionality. 

    271. Question 271. What Are Extension Interfaces?

      Answer :

      When the built-in functionalities provided by hibernate is not sufficient enough, itprovides a way so that user can include other interfaces and implement those interfaces for user desire functionality. These interfaces are called as Extension interfaces.

    272. Question 272. What Are The Extension Interfaces That Are There In Hibernate?

      Answer :

      There are many extension interfaces provided by hibernate. 
      ProxyFactory interface - used to create proxies 
      ConnectionProvider interface – used for JDBC connection management 
      TransactionFactory interface – Used for transaction management 
      Transaction interface – Used for transaction management 
      TransactionManagementLookup interface – Used in transaction management. 
      Cahce interface – provides caching techniques and strategies 
      CacheProvider interface – same as Cache interface 
      ClassPersister interface – provides ORM strategies
      IdentifierGenerator interface – used for primary key generation
      Dialect abstract class – provides SQL support. 

    273. Question 273. What Are Different Environments To Configure Hibernate?

      Answer :

      There are mainly two types of environments in which the configuration of hibernate application differs.
      i. Managed environment – In this kind of environment everything from database connections, transaction boundaries, security levels and all are defined. An example of this kind of environment is environment provided by application servers such as JBoss, Weblogic and WebSphere.
      ii. Non-managed environment – This kind of environment provides a basic configuration template. Tomcat is one of the best examples that provide this kind of environment.

    274. Question 274. What Is The File Extension You Use For Hibernate Mapping File?

      Answer :

      The name of the file should be like this : filename.hbm.xml
      The filename varies here. The extension of these files should be “.hbm.xml”.
      This is just a convention and it’s not mandatory. But this is the best practice to follow this extension.

    275. Question 275. What Do You Create A Sessionfactory?

      Answer :

      Configuration cfg = new Configuration();
      cfg.addResource("myinstance/MyConfig.hbm.xml");
      cfg.setProperties( System.getProperties() );
      SessionFactory sessions = cfg.buildSessionFactory(); 
      First, we need to create an instance of Configuration and use that instance to refer to the location of the configuration file. After configuring this instance is used to create the SessionFactory by calling the method buildSessionFactory(). 

    276. Question 276. What Is Meant By Method Chaining?

      Answer :

      Method chaining is a programming technique that is supported by many hibernate interfaces. This is less readable when compared to actual java code. And it is not mandatory to use this format. Look how a SessionFactory is created when we use method chaining. 

      SessionFactory sessions = new Configuration()
      .addResource("myinstance/MyConfig.hbm.xml")
      .setProperties( System.getProperties() )
      .buildSessionFactory(); 

    277. Question 277. What Does Hibernate.properties File Consist Of?

      Answer :

      This is a property file that should be placed in application class path. So when the Configuration object is created, hibernate is first initialized. At this moment the application will automatically detect and read this hibernate.properties file. 
      hibernate.connection.datasource = java:/comp/env/jdbc/AuctionDB
      hibernate.transaction.factory_class = 
      net.sf.hibernate.transaction.JTATransactionFactory
      hibernate.transaction.manager_lookup_class = 
      net.sf.hibernate.transaction.JBossTransactionManagerLookup
      hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect 

    278. Question 278. What Should Sessionfactory Be Placed So That It Can Be Easily Accessed?

      Answer :

      As far as it is compared to J2EE environment, if the SessionFactory is placed in JNDI then it can be easily accessed and shared between different threads and various components that are hibernate aware. You can set the SessionFactory to a JNDI by configuring a property hibernate. session_ factory_ name in the hibernate. properties file.

    279. Question 279. What Are Pojos?

      Answer :

      POJO stands for plain old java objects. These are just basic JavaBeans that have defined setter and getter methods for all the properties that are there in that bean. Besides they can also have some business logic related to that property. Hibernate applications works efficiently with POJOs rather then simple java classes.

    280. Question 280. What Is Object/relational Mapping Metadata?

      Answer :

      ORM tools require a metadata format for the application to specify the mapping between classes and tables, properties and columns, associations and foreign keys, Java types and SQL types. This information is called the object/relational mapping metadata. It defines the transformation between the different data type systems and relationship representations.

    281. Question 281. What Is Hql?

      Answer :

      HQL stands for Hibernate Query Language. Hibernate allows the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.

    282. Question 282. What Is Attribute Oriented Programming?

      Answer :

      XDoclet has brought the concept of attribute-oriented programming to Java. Until JDK 1.5, the Java language had no support for annotations; now XDoclet uses the Javadoc tag format (@attribute) to specify class-, field-, or method-level metadata attributes. These attributes are used to generate hibernate mapping file automatically when the application is built. This kind of programming that works on attributes is called as Attribute Oriented Programming.

    283. Question 283. What Are The Different Methods Of Identifying An Object?

      Answer :

      There are three methods by which an object can be identified. 
      i. Object identity –Objects are identical if they reside in the same memory location in the JVM. This can be checked by using the = = operator. 
      ii. Object equality – Objects are equal if they have the same value, as defined by the equals( ) method. Classes that don’t explicitly override this method inherit the implementation defined by java.lang.Object, which compares object identity.
      iii. Database identity – Objects stored in a relational database are identical if they represent the same row or, equivalently, share the same table and primary key value. 

    284. Question 284. What Are The Different Approaches To Represent An Inheritance Hierarchy?

      Answer :

      i. Table per concrete class.
      ii. Table per class hierarchy.
      iii. Table per subclass.

    285. Question 285. What Are Managed Associations And Hibernate Associations?

      Answer :

      Associations that are related to container management persistence are called managed associations. These are bi-directional associations. Coming to hibernate associations, these are unidirectional.

    286. Question 286. Why Do You Need Orm Tool Like Hibernate?

      Answer :

      ORM tools like hibernate provide following benefits:
      • Improved performance: Lazy loading, Sophisticated caching, Eager loading.
      • Improved productivity: High-level object-oriented API, Less Java code to write, No SQL to write.
      • Improved maintainability: A lot less code to write.
      • Improved portability: ORM framework generates database-specific SQL for you.

    287. Question 287. What Are The Main Advantages Of Orm Like Hibernate?

      Answer :

      Hibernate implements extremely high-concurrency architecture with no resource-contention issues. This architecture scales extremely well as concurrency increases in a cluster or on a single machine.

      Other performance related optimizations that hibernate performs are:
      • Caching objects
      • Executing SQL statements later, when needed
      • Never updating unmodified objects
      • Efficient Collection Handling
      • Rolling two updates into one
      • Updating only the modified columns
      • Outer join fetching
      • Lazy collection initialization
      • Lazy object initialization.

    288. Question 288. What Are The Core Interfaces Of Hibernate Framework?

      Answer :

      1. Session Interface: The basic interface for all hibernate applications. The instances are light weighted and can be created and destroyed without expensive process.
      2. SessionFactory interface: The delivery of session objects to hibernate applications is done by this interface. For the whole application, there will be generally one SessionFactory and can be shared by all the application threads.
      3. Configuration Interface: Hibernate bootstrap action is configured by this interface. The location specification is specified by specific mapping documents, is done by the instance of this interface.
      4. Transaction Interface: This is an optional interface. This interface is used to abstract the code from a transaction that is implemented such as a JDBC / JTA transaction.
      5. Query and Criteria interface: The queries from the user are allowed by this interface apart from controlling the flow of the query execution.

    289. Question 289. What Is A Hibernatetemplate?

      Answer :

      HibernateTemplate is a helper class that is used to simplify the data access code. This class supports automatically converts HibernateExceptions which is a checked exception into DataAccessExceptions which is an unchecked exception. HibernateTemplate is typically used to implement data access or business logic services. The central method is execute(), that supports the Hibernate code that implements HibernateCallback interface.

    290. Question 290. What Are The Benefits Of Hibernatetemplate?

      Answer :

      The benefits of HibernateTemplate are:
      • HibernateTemplate, which is a Spring Template class, can simplify the interactions with Hibernate Sessions.
      • Various common functions are simplified into single method invocations.
      • The sessions of hibernate are closed automatically.
      • The exceptions will be caught automatically, and converts them into runtime exceptions.

    291. Question 291. What Is Hibernate Proxy?

      Answer :

      Mapping of classes can be made into a proxy instead of a table. A proxy is returned when actually a load is called on a session. The proxy contains actual method to load the data. The proxy is created by default by Hibernate, for mapping a class to a file. The code to invoke Jdbc is contained in this class.

    292. Question 292. Explain The Types Of Hibernate Instance States.

      Answer :

      The persistent class’s instance can be in any one of the three different states. These states are defined with a persistence context. The Hibernate has the following instance states:
      • Transient: This instance is never been associated with any one of the persistence process. This does not have persistent identity like primary key value.
      • Persistent: A persistent context is made to associate with the current instance. It has persistent identity like primary key value and a corresponding row of a table in the data base. Hibernate guarantees the persistent identity is equivalent to the java Identity [object], for a particular persistence context.
      • Detatched: This instance association with a persistence context is only once and the context was closed or serialized to another process. The persistent identity is retained and it can be a corresponding row in a database.

    293. Question 293. What Are Collection Types In Hibernate?

      Answer :

      • ArrayType,
      Constructor: ArrayType(String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML)
      • BagType,
      Constructor: BagType(String role, String propertyRef, boolean isEmbeddedInXML)
      • CustomCollectionType, A custom type for mapping user-written classes that implement PersistentCollection Constructor: CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML)
      • IdentifierBagType,
      Constructor: IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML)
      • ListType,
      Constructor: ListType(String role, String propertyRef, boolean isEmbeddedInXML)
      • MapType,
      Constructor: MapType(String role, String propertyRef, boolean isEmbeddedInXML)
      • SetType
      Constructor: SetType(String role, String propertyRef, boolean isEmbeddedInXML)

    294. Question 294. What Is Lazy Initialization In Hibernate?

      Answer :

      The delaying the object creation or calculating a value or some process until the first time it is needed. The retrieval of particular information only at the time when the object is accessed, is lazy initialization in hibernate. A scenario for lazy initialization is:

      When the field creation is expensive, a field may or may not be invoked.

      In this scenario the creation of a field can be deferred until the actual moment is arise to use it. The performance is increased using this technique, by avoiding unnecessary creation of objects which is expensive and consumes the memory space.

    295. Question 295. What Is Lazy Fetching In Hibernate?

      Answer :

      • Lazy setting decides whether to load child objects while loading the Parent Object.
      • This can be done by a setting in hibernate mapping file of the parent class.Lazy = true.
      • By default the lazy loading of the child objects is true.

    296. Question 296. What Is The Difference Between Sorted And Ordered Collection In Hibernate?

      Answer :

      Sorted Collection:
      The sorted collection is a collection that is sorted using the Java collections framework. The sorting is done in the memory of JVM that is running hibernate, soon after reading the data from the database using Java Comparator.

      The less the collection the more the efficient of sorting.

      Ordered Collection:
      The order collections will also sorts a collection by using the order by clause for the results fetched.

      The more the collection, the more efficient of sorting.

    297. Question 297. Explain The Advantages And Disadvantages Of Detached Objects.

      Answer :

      Advantages:
      • Detached objects passing can be done across layers upto the presentation layer without using Data Transfer Objects.
      • At the time of using long transactions by the user which needs long think-time, it is suggested to split these transactions into some transactions. The detached objects get modified apart from the transaction scope which then can be re-attached to a new transaction.

      Disadvantages:
      • The usage of detached objects are cumbersome and cryptic. It is suggested not to be cluttered with the session, if possible.
      • It is recommended to use DataTransferObjects and DomainObjects that is used to maintain separation between the user interfaces and the Service.

    298. Question 298. What Is Hibernate Query Language (hql)?

      Answer :

      Hibernate Query Language is designed for data management using Hibernate technology. It is completely object oriented and hence has notions like inheritance, polymorphism and abstraction. The queries are case-sensitive. This has an exception for Java classes and properties. The query operations are through objects. HQL acts as a bridge between Objects and RDBMS.

    299. Question 299. Explain The General Flow Of Hibernate Communication With Rdbms.

      Answer :

      The general flow of Hibernate communication with RDBMS is :
      • The Hibernate configuration is to be loaded and creation of configuration object is done. The mapping of all hbm files will be performed automatically.
      • Creation of session factory from the configuration object.
      • Obtain a session from the session factory.
      • Creation of HQL Query .
      • Execution of the query in order to get the list of containing java objects.

    300. Question 300. Explain The Role Of Session Interface In Hibernate.

      Answer :

      • In hibernate, the Session interface wraps a JDBC connection, holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier and is a factory for Transaction.
      • Session session = sessionFactory.openSession();
      • The Session interface is the primary interface used by Hibernate applications.
      • It is a single-threaded, short-lived object representing a conversation between the application and the persistent store.
      • It allows you to create query objects to retrieve persistent objects.

    301. Question 301. State The Role Of Sessionfactory Interface Plays In Hibernate.

      Answer :

      • An application obtains Session instances from a SessionFactory which is typically single for the whole application created during its initialization.
      • The SessionFactory caches generate SQL statements and other mapping metadata that Hibernate uses at runtime.
      • It also holds cached data that has been read in one unit of work and may be reused in a future unit of work
      SessionFactory sessionFactory = configuration.buildSessionFactory();

    302. Question 302. What Is The Difference Between Merge And Update?

      Answer :

      update () : When the session does not contain an persistent instance with the same identifier, and if it is sure use update for the data persistence in hibernate.

      merge (): Irrespective of the state of a session, if there is a need to save the modifications at any given time, use merge().

    303. Question 303. What Is The Advantage Of Hibernate Over Jdbc?

      Answer :

      The advantages of Hibernate over JDBC are:
      • Hibernate code will work well for all databases, for ex: Oracle,MySQL, etc. where as JDBC is database specific.
      • No knowledge of SQL is needed because Hibernate is a set of objects and a table is treated as an object, where as to work with JDBC, one need to know SQL.
      • Query tuning is not required in Hibernate. The query tuning is automatic in hibernate by using criteria queries, and the result of performance is at its best. Where as in JDBC the query tuning is to be done by the database authors.
      • With the support of cache of hibernate, the data can be placed in the cache for better performance. Where as in JDBC the java cache is to be implemented.

    304. Question 304. Why Hibernate Is Advantageous Over Entity Beans & Jdbc?

      Answer :

      An entity bean always works under the EJB container, which allows reusing of the object external to the container. An object can not be detached in entity beans and in hibernate detached objects are supported.

      Hibernate is not database dependent where as JDBC is database dependent. Query tuning is not needed for hibernate as JDBC is needed. Data can be placed in multiple cache which is supported by hibernate, whereas in JDBC the cache is to be implemented.

    305. Question 305. Explain The Main Difference Between Entity Beans And Hibernate.

      Answer :

      Entity beans are to be implemented by containers, classes, descriptors. Hibernate is just a tool that quickly persist the object tree to a class hierarchy in a database and without using a single SQL statement. The inheritance and polymorphism is quite simply implemented in hibernate which is out of the box of EJB and a big drawback.

    306. Question 306. Explain The Difference Between Hibernate And Spring.

      Answer :

      Hibernate is an ORM tool for data persistency. Spring is a framework for enterprise applications. Spring supports hibernate and provides the different classes which are templates that contains the common code.

    307. Question 307. How Will You Configure Hibernate?

      Answer :

      The configuration files hibernate.cfg.xml (or hibernate.properties) and mapping files *.hbm.xml are used by the Configuration class to create (i.e. configure and bootstrap hibernate) the SessionFactory, which in turn creates the Session instances. Session instances are the primary interface for the persistence service.

      " hibernate.cfg.xml (alternatively can use hibernate.properties): These two files are used to configure the hibernate sevice (connection driver class, connection URL, connection username, connection password, dialect etc). If both files are present in the classpath then hibernate.cfg.xml file overrides the settings found in the hibernate.properties file.

      " Mapping files (*.hbm.xml): These files are used to map persistent objects to a relational database. It is the best practice to store each object in an individual mapping file (i.e mapping file per class) because storing large number of persistent classes into one mapping file can be difficult to manage and maintain. The naming convention is to use the same name as the persistent (POJO) class name. For example Account.class will have a mapping file named Account.hbm.xml. Alternatively hibernate annotations can be used as part of your persistent class code instead of the *.hbm.xml files.

    308. Question 308. What Is A Sessionfactory? Is It A Thread-safe Object?

      Answer :

      SessionFactory is Hibernates concept of a single datastore and is threadsafe so that many threads can access it concurrently and request for sessions and immutable cache of compiled mappings for a single database. A SessionFactory is usually only built once at startup. SessionFactory should be wrapped in some kind of singleton so that it can be easily accessed in an application code.
      SessionFactory sessionFactory = new Configuration().configure().buildSessionfactory();

    309. Question 309. What Is A Session? Can You Share A Session Object Between Different Theads?

      Answer :

      Session is a light weight and a non-threadsafe object (No, you cannot share it between threads) that represents a single unit-of-work with the database. Sessions are opened by a SessionFactory and then are closed when all work is complete. Session is the primary interface for the persistence service. A session obtains a database connection lazily (i.e. only when required). To avoid creating too many sessions ThreadLocal class can be used as shown below to get the current session no matter how many times you make call to the currentSession() method.
      &
      public class HibernateUtil {
      &
      public static final ThreadLocal local = new ThreadLocal();
      public static Session currentSession() throws HibernateException {
      Session session = (Session) local.get();
      //open a new session if this thread has no session
      if(session == null) {
      session = sessionFactory.openSession();
      local.set(session);
      }
      return session;
      }
      }
      It is also vital that you close your session after your unit of work completes.

    310. Question 310. What Are The Benefits Of Detached Objects?

      Answer :

      Detached objects can be passed across layers all the way up to the presentation layer without having to use any DTOs (Data Transfer Objects). You can later on re-attach the detached objects to another session.

    311. Question 311. What Are The Pros And Cons Of Detached Objects?

      Answer :

      Pros:
      " When long transactions are required due to user think-time, it is the best practice to break the long transaction up into two or more transactions. You can use detached objects from the first transaction to carry data all the way up to the presentation layer. These detached objects get modified outside a transaction and later on re-attached to a new transaction via another session.
      Cons
      " In general, working with detached objects is quite cumbersome, and better to not clutter up the session with them if possible. It is better to discard them and re-fetch them on subsequent requests. This approach is not only more portable but also more efficient because - the objects hang around in Hibernate's cache anyway.
      " Also from pure rich domain driven design perspective it is recommended to use DTOs (DataTransferObjects) and DOs (DomainObjects) to maintain the separation between Service and UI tiers.

    312. Question 312. How Does Hibernate Distinguish Between Transient (i.e. Newly Instantiated) And Detached Objects?

      Answer :

      Hibernate uses the version property, if there is one.

      If not uses the identifier value. No identifier value means a new object. This does work only for Hibernate managed surrogate keys. Does not work for natural keys and assigned (i.e. not managed by Hibernate) surrogate keys.

      Write your own strategy with Interceptor.isUnsaved().

    313. Question 313. What Is The Difference Between The Session.get() Method And The Session.load() Method?

      Answer :

      Both the session.get(..) and session.load() methods create a persistent object by loading the required object from the database. But if there was not such object in the database then the method session.load(..) throws an exception whereas session.get(&) returns null.

    314. Question 314. What Is The Difference Between The Session.update() Method And The Session.lock() Method?

      Answer :

      Both of these methods and saveOrUpdate() method are intended for reattaching a detached object. The session.lock() method simply reattaches the object to the session without checking or updating the database on the assumption that the database in sync with the detached object. It is the best practice to use either session.update(..) or session.saveOrUpdate(). Use session.lock() only if you are absolutely sure that the detached object is in sync with your detached object or if it does not matter because you will be overwriting all the columns that would have changed later on within the same transaction. Note: When you reattach detached objects you need to make sure that the dependent objects are reatched as well.

    315. Question 315. How Would You Reatach Detached Objects To A Session When The Same Object Has Already Been Loaded Into The Session?

      Answer :

      You can use the session.merge() method call.

    316. Question 316. What Are The General Considerations Or Best Practices For Defining Your Hibernate Persistent Classes?

      Answer :

      1.You must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables.
      2.You should implement the equals() and hashCode() methods based on your business key and it is important not to use the id field in your equals() and hashCode() definition if the id field is a surrogate key (i.e. Hibernate managed identifier). This is because the Hibernate only generates and sets the field when saving the object.
      3. It is recommended to implement the Serializable interface. This is potentially useful if you want to migrate around a multi-processor cluster.
      4.The persistent class should not be final because if it is final then lazy loading cannot be used by creating proxy objects.
      5.Use XDoclet tags for generating your *.hbm.xml files or Annotations (JDK 1.5 onwards), which are less verbose than *.hbm.xml files.

    317. Question 317. How Will You Communicate Between Two Applets?

      Answer :

      The simplest method is to use the static variables of a shared class since there's only one instance of the class and hence only one copy of its static variables. A slightly more reliable method relies on the fact that all the applets on a given page share the same AppletContext. We obtain this applet context as follows:

      AppletContext ac = getAppletContext();

      AppletContext provides applets with methods such as getApplet(name), getApplets(),getAudioClip, getImage, showDocument and showStatus().

    318. Question 318. How Do You Communicate In Between Applets And Servlets?

      Answer :

      We can use the java.net.URLConnection and java.net.URL classes to open a standard HTTP connection and "tunnel" to the web server. The server then passes this information to the servlet in the normal way. Basically, the applet pretends to be a web browser, and the servlet doesn't know the difference. As far as the servlet is concerned, the applet is just another HTTP client.

    319. Question 319. What Is An Applet? Should Applets Have Constructors?

      Answer :

      Applets are small programs transferred through Internet, automatically installed and run as part of web-browser. Applets implements functionality of a client. Applet is a dynamic and interactive program that runs inside a Web page displayed by a Java-capable browser. We dont have the concept of Constructors in Applets. Applets can be invoked either through browser or through Appletviewer utility provided by JDK.

    320. Question 320. How Will You Initialize An Applet?

      Answer :

      Write my initialization code in the applets init method or applet constructor.

    321. Question 321. How To Insert Your Applets Into Frontpage?

      Answer :

      1. Place the .class file in the directory containing the HTML document into which you want to insert the applet.
      2. Copy the <applet>...</applet> tag from your applet implementation or examples to the clipboard.
      3. In FrontPage select the "HTML" tab from the lower left hand corner.
      4. Paste the <applet>...</applet> tag in an appropriate place between the <body> and </body> tags. You'll find a gray box with the aqua letter "J" in the "Normal" view indicating the the applet tag has been inserted.
      5. To see the applet appearance select the "Preview" tab.

    322. Question 322. In Our Urls And In The Text Of The Buttons We Have Comma. Its Causing An Error. Is There A Way To Change The Delimiting Character For The Menu Arguments?

      Answer :

      Since 2.00 version our applets support an user-defined delimiter for the menu arguments. To modify the default delimiter add the following parameter (you can use any character as a delimiter):

      <param name="delimiter" value="~">
      and use it within "menuItems":
      <param name="menuItems" value="
      {Home~http://www.wisdomjobs.com.com/index.php}
      {Features,Setup~http://www.wisdomjobs.com/}
      ">
      

    323. Question 323. What Is The Order Of Method Invocation In An Applet?

      Answer :

      ► public void init() : Initialization method called once by browser.
      ► public void start() : Method called after init() and contains code to start processing. If the user leaves the page and returns without killing the current browser session, the start () method is called without being preceded by init ().
      ► public void stop() : Stops all processing started by start (). Done if user moves off page.
      ► public void destroy() : Called if current browser session is being terminated. Frees all resources used by applet.

    324. Question 324. What Are The Applets Life Cycle Methods? Explain Them?

      Answer :

      methods in the life cycle of an Applet:
      ► init() method - called when an applet is first loaded. This method is called only once in the entire cycle of an applet. This method usually intialize the variables to be used in the applet.
      ► start( ) method - called each time an applet is started.
      ► paint() method - called when the applet is minimized or refreshed. This method is used for drawing different strings, figures, and images on the applet window.
      ► stop( ) method - called when the browser moves off the applets page.
      ► destroy( ) method - called when the browser is finished with the applet.

    325. Question 325. What Is The Sequence For Calling The Methods By Awt For Applets?

      Answer :

      When an applet begins, the AWT calls the following methods, in this sequence:
      ► init()
      ► start()
      ► paint()
      When an applet is terminated, the following sequence of method calls takes place :
      ► stop()
      ► destroy()

    326. Question 326. How Do Applets Differ From Applications?

      Answer :

      Following are the main differences:
      Application: Stand Alone, doesnt need web-browser.
      Applet: Needs no explicit installation on local machine. Can be transferred through Internet on to the local machine and may run as part of web-browser.
      Application: Execution starts with main() method. Doesnt work if main is not there.
      Applet: Execution starts with init() method.
      Application: May or may not be a GUI.
      Applet: Must run within a GUI (Using AWT). This is essential feature of applets.

    327. Question 327. Can We Pass Parameters To An Applet From Html Page To An Applet? How?

      Answer :

      We can pass parameters to an applet using <param> tag in the following way:

      ► <param name=param1″ value=value1″>
      ► <param name=param2″ valuevalue2″>

      Access those parameters inside the applet is done by calling getParameter() method inside the applet. Note that getParameter() method returns String value corresponding to the parameter name.

    328. Question 328. How Do We Read Number Information From My Applets Parameters, Given That Applets Getparameter() Method Returns A String?

      Answer :

      Use the parseInt() method in the Integer Class, the Float(String) constructor or parseFloat() method in the Class Float, or the Double(String) constructor or parseDoulbl() method in the class Double.

    329. Question 329. How Can I Arrange For Different Applets On A Web Page To Communicate With Each Other?

      Answer :

      Name your applets inside the Applet tag and invoke AppletContexts getApplet() method in your applet code to obtain references to the other applets on the page.

    330. Question 330. How Do I Select A Url From My Applet And Send The Browser To That Page?

      Answer :

      Ask the applet for its applet context and invoke showDocument() on that context object.

      URL targetURL;
      String URLString
      AppletContext context = getAppletContext();
      try
      {
      targetURL = new URL(URLString);
      }
      catch (MalformedURLException e)
      {
      // Code for recover from the exception
      }
      context. showDocument (targetURL);

    331. Question 331. Can Applets On Different Pages Communicate With Each Other?

      Answer :

      Use the getSize() method, which the Applet class inherits from the Component class in the Java.awt package. The getSize() method returns the size of the applet as a Dimension object, from which you extract separate width, height fields. The following code snippet explains this:
      Dimension dim = getSize();
      int appletwidth = dim.width();
      int appletheight = dim.height();

    332. Question 332. Which Classes And Interfaces Does Applet Class Consists?

      Answer :

      Applet class consists of a single class, the Applet class and three interfaces: AppletContext, AppletStub, and AudioClip.

    333. Question 333. What Is Appletstub Interface?

      Answer :

      The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface.

    334. Question 334. What Are The Applets Information Methods?

      Answer :

      The following are the Applets information methods: getAppletInfo() method: Returns a string describing the applet, its author, copyright information, etc. getParameterInfo() method: Returns an array of string describing the applets parameters.

    335. Question 335. What Are The Steps Involved In Applet Development?

      Answer :

      Following are the steps involved in Applet development:
      ► Create/Edit a Java source file. This file must contain a class which extends Applet class.
      ► Compile your program using javac
      ► Execute the appletviewer, specifying the name of your applets source file or html file. In case the applet information is stored in html file then Applet can be invoked using java enabled web browser.

    336. Question 336. Which Method Is Used To Output A String To An Applet? Which Function Is This Method Included In?

      Answer :

      drawString( ) method is used to output a string to an applet. This method is included in the paint method of the Applet.

    337. Question 337. When Is Update Method Called?

      Answer :

      Whenever a screen needs redrawing (e.g., upon creation, resizing, validating) the update method is called. By default, the update method clears the screen and then calls the paint method, which normally contains all the drawing code.

    338. Question 338. What Is A Message Driven Bean, What Functions Does A Message Driven Bean Have And How Do They Work In Collaboration With Jms?

      Answer :

      Message driven beans are the latest addition to the family of component bean types defined by the EJB specification. The original bean types include session beans, which contain business logic and maintain a state associated with client sessions, and entity beans, which map objects to persistent data. Message driven beans will provide asynchrony to EJB based applications by acting as JMS message consumers. A message bean is associated with a JMS topic or queue and receives JMS messages sent by EJB clients or other beans. Unlike entity beans and session beans, message beans do not have home or remote interfaces. Instead, message driven beans are instantiated by the container as required. Like stateless session beans, message beans maintain no client-specific state, allowing the container to optimally manage a pool of message-bean instances. Clients send JMS messages to message beans in exactly the same manner as they would send messages to any other JMS destination. This similarity is a fundamental design goal of the JMS capabilities of the new specification. To receive JMS messages, message driven beans implement the javax.jms.MessageListener interface, which defines a single onMessage() method. When a message arrives, the container ensures that a message bean corresponding to the message topic/queue exists (instantiating it if necessary), and calls its onMessage method passing the client’s message as the single argument. The message bean’s implementation of this method contains the business logic required to process the message. Note that session beans and entity beans are not allowed to function as message beans.

    339. Question 339. How Does Concurrency Work For Message-driven Beans?

      Answer :

      The way concurrency is achieved for Queues is by spawning one JMSSession per MDB instance in the pool. Since JMSSessions are processed in parallel by JMS, concurrency is obtained naturally this way and JMS takes care of delivering the message to, at most, one listener. If an MDB is deployed to multiple servers in a cluster, JMSSessions are created for each MDB instance on each server and load balancing will be done across them. For Topics in WebLogic JMS 6.1, there is one JMSSession per bean instance in the pool. Because of the way Topics work, the session, and thus every bean instance, receives a copy of each message published on that Topic. (There was also a problem that caused parallel processing not to work correctly. This has been fixed for WLS 6.0 Service Pack 1.) Within a single server, one topic consumer is used to pass out messages to multiple threads to get the concurrency while producing only a single copy of each message. You can configure multiple MDBs to listen on the same topic and each MDB will receive a copy of every message. When using multiple servers, each server gets its own consumer and therefore its own copy of each message. It is not currently possible to share a consumer across multiple servers. If you want a message to be processed by exactly one MDB, use a queue. One customer had an example where topic MDBs are needed in which there will be multiple implementations of the MDBs listening on the same topic. In other words, more than one MDB with a different implementation may be subscribing to the same topic. The client has no advanced way of knowing how many different kinds of MDBs may be listening on the same topic, but it is possible for there to be more than one listener, therefore topics, not queues. For each kind of MDB listening on the topic, the message is delivered exactly once (i.e., the message will be delivered exactly once to an instance in each named MDB pool listening on the topic).

    340. Question 340. What Is The Difference Between Message Driven Beans And Stateless Session Beans?

      Answer :

      In several ways, the dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call. However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways: Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls. Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic.

      Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.

    341. Question 341. What Is Message Driven Beam?

      Answer :

      An enterprise bean that is an asynchronous message consumer. A message-driven bean has no state for a specific client, but its instance variables can contain state across the handling of client messages, including an open database connection and an object reference to an EJB object. A client accesses a message-driven bean by sending messages to the destination for which the bean is a message listener.

    342. Question 342. What Is Session Bean. What Are The Various Types Of Session Bean?

      Answer :

      SessionBeans typically are used to represent a client they are of two types:

      Stateful Session Beans : they maintain conversational state between subsequest calls by a client.
      Stateless Session Bean : consider this as a servlet equivalent in EJB. It is just used to service clients regardless of state and does not maintain any state.

    343. Question 343. What Is The Difference Between Stateful Session Bean And Stateless Session Bean

      Answer :

      Stateful session beans have the passivated and Active state which the Stateless bean does not have.

    344. Question 344. What Are The Call Back Methods In Session Bean?

      Answer :

      Session bean callback methods differ whether it is Stateless or stateful Session bean they are.

      Stateless Session Bean
      1. setSessionContext()
      2. ejbCreate()
      3. ejbRemove()

      Stateful Session Bean
      1. setSessionContext()
      2.ejbCreate()
      3.ejbPassivate()
      4.ejbActivate()
      5.ejbRemove()

    345. Question 345. When You Will Chose Stateful Session Bean And Stateless Session Bean

      Answer :

      stateful session bean is used when we need to maintain the client state . Where stateless session bean will not have a client state it will be in pool. Example of statefull session is Shoping cart site where we need to maintain the client state .

    346. Question 346. What Is The Relationship Between Enterprise Javabeans And Javabeans?

      Answer :

      Enterprise JavaBeans extends the JavaBeans component model to handle the needs of transactional business applications.

      JavaBeans is a component model for visual construction of reusable components for the Java platform. Enterprise JavaBeans extends JavaBeans to middle-tier/server side business applications. The extensions that Enterprise JavaBeans adds to JavaBeans include support for transactions, state management, and deployment time attributes.

      Although applications deploying the Enterprise JavaBeans architecture are independent from the underlying communication protocol, the Enterprise JavaBeans architecture specifies how communication among components maps into the underlying communication protocols, such as CORBA/IIOP.

    347. Question 347. How To Implement A Bound Property In Your Bean Application?

      Answer :

      To implement a bound property in the application, follow these steps:
      ► Import the java.beans package. This gives you access to the PropertyChangeSupport class.
      ► Instantiate a PropertyChangeSupport object. This object maintains the property change listener list and fires property change events. You can also make your class a PropertyChangeSupport subclass.
      ► Implement methods to maintain the property change listener list. Since a PropertyChangeSupport subclass implements these methods, you merely wrap calls to the property-change support object's methods.
      ► Modify a property's set method to fire a property change event when the property is changed.

    348. Question 348. How And When Will The Javabeans Migration Assistant To Activex Be Available?

      Answer :

      IBM plans to ship the JavaBeans Migration Assistant for ActiveX in Taligent's Visual Age, WebRunner Toolkit, and Visual Age for Java development tools. This will allow developers to utilize a common component model that may be leveraged by a wide range of tools, including the IBM Visual Age for Java family.

    349. Question 349. Why Would A Developer Need The Javabeans Migration Assistant For Activex?

      Answer :

      Many of the capabilities that are so exciting to JavaBeans developers are not available on ActiveX, or are incomplete. There is, therefore, a need for a set of conversion conventions and tools designed to convert desktop ActiveX components into JavaBeans components. The resulting Beans will be usable in both in new network savvy e-business applications as well as traditional desktop applications, includingActiveX containers. Developers and customers benefit from the advantages offered by JavaBeans by simply leveraging their current investments in ActiveX.

    350. Question 350. Can Javabeans Use Dcom As Its Network Model?

      Answer :

      JavaBeans works with any network model (i.e., to communicate between components across the network), including CORBA, DCOM, etc. JavaBeans integrates well with CORBA IDL, which is an excellent solution for customers in a heterogeneous distributed computing environment with platform independent components. However, we recommend RMI for Java to Java inter-object communication.

    351. Question 351. Can Both Java Applets And Javabeans Components Use The Infobus?

      Answer :

      Yes.

    352. Question 352. Javabeans Has Mechanisms Like Bound Properties For Data Transfer Between Components. Why Is The Infobus Necessary?

      Answer :

      JavaBeans mechanisms, such as bound properties, are very useful in cases where the type of data to be communicated can be hard-coded into the source and target components. The InfoBus adds additional features required for more dynamic data interchange. These can be cases where communication is driven by the content of the data and where the nature of the data to be exchanged is determined at runtime.

    353. Question 353. Is Infobus Easy To Use?

      Answer :

      Using InfoBus aware components, such as the ESuite components from Lotus, users can easily construct powerful data driven applications. No programming or scripting is required: simple parameters are used to establish connections to databases and to select data for processing. For developers creating InfoBus components, InfoBus offers a straightforward API compatible in style with other features of JavaBeans.

    354. Question 354. Does The Infobus Compete With Javabeans?

      Answer :

      On the contrary, InfoBus extends the power of JavaBeans to a new range of more dynamic applications. InfoBus is fully compatible with JavaBeans, and Lotus enthusiastically supports JavaBeans as the component standard for Java. Wherever possible, InfoBus uses the existing mechanisms of JavaBeans.

    355. Question 355. What Is The Infobus?

      Answer :

      The InfoBus is a compact Java API which allows cooperating applets or Beans, on a Web page or in any other Java application, to communicate data to one another. The InfoBus architecture enables Beans to be categorized as "data providers" and "data consumers". Data providers are Beans whose primary function is to access data from their native store, such as a DBMS, spreadsheet, flat file, Lotus Notes database etc., and to offer data onto the InfoBus.

      Data consumers retrieve data from the bus, for analysis or visual display. This segregation of provider from consumer is extremely powerful in that it enables applications to be independent of their data; for example, a charting Bean need not understand SQL or JDBC in order to access DBMS data.

      Of course, a Bean can be both a consumer and provider: for example a spreadsheet may accept data from a DBMS and provide data to a chart Bean.

    356. Question 356. What Are/is Enterprise Javabeans?

      Answer :

      Enterprise JavaBeans (EJB) is an API specification for building scalable, distributed, component-based, multi-tier applications. It leverages and extends the JavaBeans component model to provide a rich object-oriented transactional environment for developers building enterprise applications.

      Enterprise JavaBeans (EJB) technology is the basis of Java 2 Platform, Enterprise Edition (J2EE). EJB technology provides the scalable architecture for executing business logic in a distributed computing environment. J2EE makes the life of an enterprise developer easier by combining the EJB component architecture with other enterprise technologies to solutions on the Java platform for seamless development and deployment of server side applications.

    357. Question 357. Who Is Developing The Javabeans Migration Assistant To Activex?

      Answer :

      IBM and Taligent, its object oriented technology subsidiary, with support from JavaSoft, are developing a set of conversion conventions, a porting guide and tool that will allow developers to easily convert their Windows ActiveX components into JavaBeans.

    358. Question 358. Why Is The Javabeans Bridge For Activex Only Available On Windows/x86?

      Answer :

      Sun's JavaBeans Bridge for ActiveX is platform specific due to the platform specific nature of ActiveX. Currently, ActiveX is essentially a Window/X86 platform specific component architecture.

      If Microsoft delivers ActiveX libraries and ActiveX applications on other platforms, Sun will evaluate customer demand and respond accordingly.

    359. Question 359. What Is The Relation Between The Infobus And Rmi?

      Answer :

      The InfoBus architecture addresses Beans talking to one in a single JVM not across multiple JVMs; while RMI (Remote Method Invocation) is intended for communication across JVMs (different Java Virtual Machines across the network). As for IIOP, one can envision a JavaBeans component that uses RMI to talk to something on another JVM and then publishes the data on the InfoBus.

      Additionally, RMI could be used to allow components in different security classes to communicate within the same JVM.

    360. Question 360. Difference Between Java Beans And Enterprise Java Beans?

      Answer :

      • JavaBeans may be visible or nonvisible at runtime.For example, the visual GUI component may be a button,list box,graphic or a chart. An EJB is a nonvisual ,remote object.
      • JavaBeans are intended to be local to a single process and are primarly intended to run on the client side.Although one can develop server-side JavaBeans,it is far easier to develop them using the EJB specification instead. EJB's are remotely executable components or business objects that can be deployed only on the server.
      • JavaBeans is a component technology to create generic Java components that can be composed together into applets and applications.
      • Even though EJB is a component technology,it neither builds upon nor extends the original JavaBean specification.
      • JavaBeans have an external interface called the properties interface, which allows a builder tool to interpret the functionality of the bean. EJBs have a dployement descriptor that describes its functionality to an external builder tool or IDE
      • JavaBeans may have BeanInfo classes,property editors or customizers.

    361. Question 361. Is The Infobus Client Side Only?

      Answer :

      Yes. InfoBus is typically used to communicate among Beans at the client, and it can also be useful for sharing information among components at a single server site. The initial version of InfoBus is not distributed, and is therefore not intended for transmission of data between clients and servers.

      A variety of Java communication services, including JDBC, CORBA, and RMI can be used by InfoBus components for access to distributed data. For example, the ESuite Data Access component is a Bean that connects any JDBC compliant data source to the InfoBus. Once the data is on the bus, it can easily be imported by any InfoBus Data Consumer, such as a spreadsheet, chartingcomponent, word processor or data analysis tool.

    362. Question 362. Will The General Public Have Access To The Infobus Apis?

      Answer :

      Yes, under the usual terms of the JDK license. The specification and technology preview are available in our products archive.

    363. Question 363. How Does The Infobus Relate To Javabeans?

      Answer :

      The InfoBus specification extends JavaBeans by providing a set of enhanced interfaces to share and exchange dynamic data.

    364. Question 364. What Is Glasgow?

      Answer :

      Glasgow - the code name for add-ins to the JavaBeans specification. It contains following specifications:
      ► The Extensible Runtime Containment and Services Protocol.
      ► The Drag and Drop Subsystem for the Java Foundation Classes.
      ► The JavaBeans Activation Framework.

    365. Question 365. How To Create Bound Property In Bean Application?

      Answer :

      To create the title property as a bound property for the MyBean component in the NetBeans GUI Builder, perform the following sequence of operations:

      • Right-click the Bean Patterns node in the MyBean class hierarchy.
      • Select Add|Property from the pop-up menu.
      • Fill the New Property Pattern form and click OK.

    366. Question 366. What Is The Serializable Class In Java Beans?

      Answer :

      Any class is serializable as long as that class or a parent class implements the java.io.Serializable interface. Examples of serializable classes include Component, String, Date, Vector, and Hashtable.

    367. Question 367. How To Control Serialization In Java Beans?

      Answer :

      Three ways to control serilization in java beans:
      1.Automatic serialization, implemented by the Serializable interface. The Java serialization software serializes the entire object, except transient and static fields.
      2.Customized serialization. Selectively exclude fields you do not want serialized by marking with the transient (or static) modifier.
      3.Customized file format, implemented by the Externalizable interface and its two methods. Beans are written in a specific file format.

    368. Question 368. What Is Introspection Properties In Java Beans?

      Answer :

      Introspection is the automatic process of analyzing a bean's design patterns to reveal the bean's properties, events, and methods.

    369. Question 369. What Are Introspection Api In Java Beans?

      Answer :

      The JavaBeans API architecture supplies a set of classes and interfaces to provide introspection. The BeanInfo (in the API reference documentation) interface of the java.beans package defines a set of methods that allow bean implementors to provide explicit information about their beans. By specifying BeanInfo for a bean component, a developer can hide methods, specify an icon for the toolbox, provide descriptive names for properties, define which properties are bound properties, and much more.

      The getBeanInfo(beanName) (in the API reference documentation) of the Introspector (in the API reference documentation) class can be used by builder tools and other automated environments to provide detailed information about a bean. The getBeanInfo method relies on the naming conventions for the bean's properties, events, and methods. A call to getBeanInfo results in the introspection process analyzing the bean?s classes and superclasses.

    370. Question 370. What Is Bean Customization?

      Answer :

      Customization provides a means for modifying the appearance and behavior of a bean within an application builder so it meets your specific needs. There are several levels of customization available for a bean developer to allow other developers to get maximum benefit from a bean?s potential functionality.

      1.By using a property editor. Each bean property has its own property editor. The NetBeans GUI Builder usually displays a bean's property editors in the Properties window. The property editor that is associated with a particular property type edits that property type.
      2. By using customizers. Customizers give you complete GUI control over bean customization. Customizers are used where property editors are not practical or applicable. Unlike a property editor, which is associated with a property, a customizer is associated with a bean.

    371. Question 371. What Is Ejb Container?

      Answer :

      A container that implements the EJB component contract of the J2EE architecture. This contract specifies a runtime environment for enterprise beans that includes security, concurrency, life-cycle management, transactions, deployment, naming, and other services. An EJB container is provided by an EJB or J2EE server.

    372. Question 372. What Is Ejb Context?

      Answer :

      A vendor that supplies an EJB container. An object that allows an enterprise bean to invoke services provided by the container and to obtain the information about the caller of a client-invoked method.

    373. Question 373. What Is Ejb Home Object?

      Answer :

      An object that provides the life-cycle operations (create, remove, find) for an enterprise bean. The class for the EJB Home object is generated by the container's deployment tools. The EJB Home object implements the enterprise bean's Home interface. The client references an EJB Home object to perform life-cycle operations on an EJB object. The client uses JNDI to locate an EJB Home object.

    374. Question 374. What Is Ejb Object?

      Answer :

      An object whose class implements the enterprise bean's remote interface. A client never references an enterprise bean instance directly. A client always references an EJB object. The class of an EJB object is generated by a container's deployment tools.

    375. Question 375. What Is Entity Bean?

      Answer :

      An enterprise bean that represents persistent data maintained in a database. An entity bean can manage its own persistence or can delegate this function to its container. An entity bean is identified by a primary key. If the container in which an entity bean is hosted crashes, the entity bean, its primary key, and any remote references survive the crash.

    376. Question 376. What Is Ejb Server?

      Answer :

      Software that provides services to an EJB container. For example, an EJB container typically relies on a transaction manager that is part of the EJBserver to perform the two-phase commit across all the participating resource managers. The J2EE architecture assumes that an EJB container is hosted by an EJBserver from the same vendor, so it does not specify the contract between these two entities. An EJB server can host one or more EJB containers.

    377. Question 377. What Is Enterprise Information System?

      Answer :

      The applications that constitute an enterprise's existing system for handling companywide information. These applications provide an information infrastructure for an enterprise. An enterpriseinformation system offers a well-defined set of services to its clients. These services are exposed to clients as local or remote interfaces or both. Examples of enterprise information systems include enterprise resource planning systems, mainframe transaction processing systems, and legacy database systems.

    378. Question 378. What Is Enterprise Javabeans?

      Answer :

      A component architecture for the development and deployment of object-oriented, distributed, enterprise-level applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and secure.

    379. Question 379. What Is Enterprise Javabeans Query Language?

      Answer :

      Defines the queries for the finder and select methods of an entity bean having container-managed persistence. A subset of SQL92, EJB QL has extensions that allow navigation over the relationships defined in an entity bean's abstract schema.

    380. Question 380. What Is Enterprise Bean Provider?

      Answer :

      An application developer who produces enterprise bean classes, remote and Interview Questions - Home interfaces, and deployment descriptor files, and packages them in an EJB JAR file.

    381. Question 381. What Is An Entity?

      Answer :

      A distinct, individual item that can be included in an XML document by referencing it. Such an entity reference can name an entity as small as a character (for example, <, which references the less-than symbol or left angle bracket, <). An entity reference can also reference an entire document, an external entity, or a collection of DTD definitions.

    382. Question 382. What Is Entity Reference?

      Answer :

      A reference to an entity that is substituted for the reference when the XML document is parsed. It can reference a predefined entity such as or reference one that is defined in the DTD. In the XML data, the reference could be to an entity that is defined in the local subset of the DTD or to an external XML file (an external entity). The DTD can also carve out a segment of DTD specifications and give it a name so that it can be reused (included) at multiple points in the DTD by defining a parameter entity.

    383. Question 383. What Are The Security Implications For Downloading Beans Over The Internet?

      Answer :

      JavaBeans does not add any security features to the Java platform. Rather, JavaBeans components have full access to the broad range of security features that are part of the Java platform. JavaBeans components can be used to build a range of different kinds of solutions from full-fledged Java desktop applications to web-based Applets.

    384. Question 384. Why Do I Get A Duplicate Name Error When Loading A Jar File?

      Answer :

      The most common reason for a "java.lang.ClassFormatError: Duplicate name" error is that a .class file in the JAR contains a class whose class name is different from the expected name. So for example if you have a file called "a/B.class" and it contains a class called "B" or "a.X" instead of the class "a.B" then you will get this error.

      The most common causes for this problem are either forgetting to include a "package a;" statement or having a "package" statement with the wrong name.

    385. Question 385. What Is The Relationship Between Sun S Jfcs And Javabeans?

      Answer :

      The JFC (Java Foundation Classes) is based upon the AWT (Abstract Windowing Toolkit), which has been part of the Java platform from the beginning. JFC effectively adds a richer set of visual elements for building JavaBeans components and applications. See the JFC web site for more information.

    386. Question 386. Are There Javabeans Components Available That I Can Buy Today?

      Answer :

      Yes. A large number of companies, both large and small, have announced their plans to deliver JavaBeans-based products.

    387. Question 387. What Kind Of Industry Support Exists For Javabeans?

      Answer :

      A coalition of industry leaders in component development worked with JavaSoft to create the JavaBeans specification, which was released to the Internet for public comments on September 4, 1996. The "frozen" JavaBeans specification combines the work of Apple, Borland, IBM, JustSystem, Microsoft, Netscape, Rogue Wave, SunSoft and Symantec and many, many others... We're very pleased to see the tools community swiftly embracing JavaBeans by announcing support for JavaBeans in their visual application builder tools.

    388. Question 388. Why A Component Architecture For The Java Platform?

      Answer :

      JavaBeans brings the extraordinary power of the Java platform to component development, offering the ideal environment for a developer who wants to extend the concept of reusable component development beyond one platform and one architecture to embrace every platform and every architecture in the industry.

    389. Question 389. Is Javabeans A Complete Component Architecture?

      Answer :

      JavaBeans is a complete component model. It supports the standard component architecture features of properties, events, methods, and persistence. In addition, JavaBeans provides support for introspection (to allow automatic analysis of a JavaBeanscomponent) and customization (to make it easy to configure a JavaBeans component).

    390. Question 390. Why Are Component Architectures Useful?

      Answer :

      Developers are turning to creating components rather than monolithic applications to free themselves from slow, expensive application development, and to build up a portable, reusable code base. This enables developers to quickly attack new market opportunities, new joint development opportunities, and new ways to sell smaller packages of software.

    391. Question 391. What Is A Bean? Why Is Not A Bean An Applet?

      Answer :

      JavaBeans components, or Beans, are reusable software components that can be manipulated visually in a builder tool. Beans can be combined to create traditional applications, or their smaller web-oriented brethren, applets. In addition, applets can be designed to work as reusable Beans.

      Individual Beans will function quite differently, but typical unifying features that distinguish a Bean are:
      ► Introspection: enables a builder tool to analyze how a Bean works.
      ► Customization: enables a developer to use an app builder tool to customize the appearance and behavior of a Bean.
      ► Events: enables Beans to communicate and connect together.
      ► Properties: enable developers to customize and program with Beans.
      ► Persistence: enables developers to customize Beans in an app builder, and then retrieve those Beans, with customized features intact, for future use.

    392. Question 392. Difference Between Java Bean And Bean?

      Answer :

      A Java Bean is a software component written in the Java programming language that conforms to the JavaBeans component specification. The JavaBeans APIs became part of the "core" Java APIs as of the 1.1 release of the JDK. The JavaBeans specification defines a Java-based software component model that adds a number of features to the Java programming language. Some of these features include:

      ► introspection
      ► customization
      ► events
      ► properties
      ► persistence

      Enterprise JavaBeans (EJBs) are Java-based software components that are built to comply with Java's EJB specification and run inside of an EJB container supplied by a J2EE provider. An EJB container provides distributed application functionality such as transaction support, persistence and lifecycle management for the EJBs.

    393. Question 393. Write A Simple Bean Program?

      Answer :

      Write the SimpleBean code. Put it in a file named SimpleBean.java, in the directory of your choice. Here's the code:

      import java.awt.Color;
      import java.beans.XMLDecoder;
      import javax.swing.JLabel;
      import java.io.Serializable;

      public class SimpleBean extends JLabel
      implements Serializable {
      public SimpleBean() {
      setText( "Hello world!" );
      setOpaque( true );
      setBackground( Color.RED );
      setForeground( Color.YELLOW );
      setVerticalAlignment( CENTER );
      setHorizontalAlignment( CENTER );
      }
      }

    394. Question 394. What Is Property Editor In Java Beans?

      Answer :

      A property editor is a tool for customizing a particular property type. Property editors are activated in the Properties window. This window determines a property's type, searches for a relevant property editor, and displays the property's current value in a relevant way.

    395. Question 395. What Are The Purpose Of Introspection?

      Answer :

      A growing number of Java object repository sites exist on the Internet in answer to the demand for centralized deployment of applets, classes, and source code in general. Any developer who has spent time hunting through these sites for licensable Java code to incorporate into a program has undoubtedly struggled with issues of how to quickly and cleanly integrate code from one particular source into an application.

      The way in which introspection is implemented provides great advantages, including:
      ► Portability - Everything is done in the Java platform, so you can write components once, reuse them everywhere. There are no extra specification files that need to be maintained independently from your component code. There are no platform-specific issues to contend with. Your component is not tied to one component model or one proprietary platform. You get all the advantages of the evolving Java APIs, while maintaining the portability of your components.
      ► Reuse - By following the JavaBeans design conventions, implementing the appropriate interfaces, and extending the appropriate classes, you provide yourcomponent with reuse potential that possibly exceeds your expectations.

    396. Question 396. What Are Externizable Interface?

      Answer :

      Use the Externalizable interface when you need complete control over your bean's serialization (for example, when writing and reading a specific file format). To use the Externalizable interface you need to implement two methods: readExternal and writeExternal. Classes that implement Externalizable must have a no-argument constructor.

    397. Question 397. What Is Bean Persistance Property?

      Answer :

      A bean has the property of persistence when its properties, fields, and state information are saved to and retrieved from storage. Component models provide a mechanism for persistence that enables the state of components to be stored in a non-volatile place for later retrieval.

    398. Question 398. Why Do I Get A Nullpointerexception When Loading A Jar File Into The Beanbox?

      Answer :

      Usually this is because of a mistake in the JAR file being loaded. In the meantime, typical errors include:

      ► The MANIFEST file uses classes using the wrong file separator ("/" should be used in all platforms).
      ► The MANIFEST file refers to classes in a package but the actual .class files are not really in that package.

    399. Question 399. What Are Java Beans?

      Answer :

      Java Beans are usual Java classes which adhere to certain coding conventions:
      ► Implements java.io.Serializable interface
      ► Provides no argument constructor
      ► Provides getter and setter methods for accessing it's properties.

    400. Question 400. What Are The Different Kinds Of Enterprise Beans?

      Answer :

      Stateless session bean- An instance of these non-persistent EJBs provides a service without storing an interaction or conversation state between methods. Any instance can be used for any client.

      Stateful session bean-An instance of these non-persistent EJBs maintains state across methods and transactions. Each instance is associated with a particular client.

      Entity bean-An instance of these persistent EJBs represents an object view of the data, usually rows in a database. They have a primary key as a unique identifier. Entity bean persistence can be either container-managed or bean-managed. 

      Message-drivenbean- An instance of these EJBs is integrated with the Java Message Service (JMS) to provide the ability for message-driven beans to act as a standard JMS message consumer and perform asynchronous processing between the server and the JMS message producer.

    401. Question 401. What Are The Methods Of Entity Bean?what Is The Difference Between Container-managed Persistent (cmp) Bean And Bean-managed Persistent(bmp) ?

      Answer :

      Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean's state with the database is handled automatically by the container. This means that the bean developer doesn't need to write any data access logic, while the EJB server is supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean. A CMP bean developer doesn't need to worry about JDBC code and transactions, because the Container performs database calls and transaction management instead of the programmer. Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class. All table mapping is specified in the deployment descriptor. Otherwise, a BMP bean developer takes the load of linking an application and a database on his shoulders.

      The bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container. The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.BMP beans are not 100% database-independent, because they may contain database-specific code, but CMP beans are unable to perform complicated DML (data manipulation language) statements. EJB 2.0 specification introduced some new ways of querying database (by using the EJB QL - query language).

    402. Question 402. What Is Software Architecture Of Ejb?

      Answer :

      Session and Entity EJBs consist of 4 and 5 parts respetively:
      1. A remote interface (a client interacts with it),
      2. A home interface (used for creating objects and for declaring business methods),
      3. A bean object (an object, which actually performs business logic and EJB-specific operations).
      4. A deployment descriptor (an XML file containing all information required for maintaining the EJB) or a set of deployment descriptors (if you are using some container-specific features).
      5.A Primary Key class - is only Entity bean specific.

    403. Question 403. Can Entity Beans Have No Create() Methods?

      Answer :

      Yes. In some cases the data is inserted NOT using Java application, so you may only need to retrieve the information, perform its processing, but not create your own information of this kind.

    404. Question 404. What Is Bean Managed Transaction?

      Answer :

      If a developer doesn't want a Container to manage transactions, it's possible to implement all database operations manually by writing the appropriate JDBC code. This often leads to productivity increase, but it makes an Entity Bean incompatible with some databases and it enlarges the amount of code to be written. All transaction management is explicitly performed by a developer.

    405. Question 405. What Are Transaction Attributes?

      Answer :

      The transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean’s home or component interface or when the method is invoked as the result of the arrival of a JMS message. (Sun's EJB Specification) Below is a list of transactional attributes:

      1. NotSupported - transaction context is unspecified.

      2. Required - bean's method invocation is made within a transactional context. If a client is not associated with a transaction, a new transaction is invoked automatically. 

      3. Supports - if a transactional context exists, a Container acts like the transaction attribute is Required, else - like NotSupported.

      4. RequiresNew - a method is invoked in a new transaction context.

      5. Mandatory - if a transactional context exists, a Container acts like the transaction attribute is Required, else it throws a javax.ejb.TransactionRequiredException.

      6. Never - a method executes only if no transaction context is specified.

    406. Question 406. What Are Transaction Isolation Levels In Ejb?

      Answer :

      1. Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB(fast but not wise).
      2. Transaction_read_committed- Guarantees that the data you are getting has been committed.
      3. Transaction_repeatable_read - Guarantees that all reads of the database will be the same during the transaction (good for read and update operations).
      4. Transaction_serializable- All the transactions for resource are performed serial.

    407. Question 407. How Ejb Invocation Happens?

      Answer :

      1. Retrieve Home Object reference from Naming Service via JNDI.
      2. Return Home Object reference to the client.
      3. Create a new EJB Object through Home Object interface.
      4. Create EJB Object from the Ejb Object
      5. Return EJB Object reference to the client.
      6.  Invoke business method using EJB Object reference.
      7. Delegate request to Bean (Enterprise Bean).

    408. Question 408. Is It Possible To Share An Httpsession Between A Jsp And Ejb? What Happens When I Change A Value In The Httpsession From Inside An Ejb?

      Answer :

      You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value", that means that its read-only in the EJB. If anything is altered from inside the EJB, it wont be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it IS possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object oriented design. This is because you are creating an unnecessary coupling between back-end objects (ejbs) and front-end objects (HttpSession). Create a higher-level of abstraction for your ejbs api. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your ejb needs to support a non-http-based client. This higher level of abstraction will be flexible enough to support it.

    409. Question 409. The Ejb Container Implements The Ejbhome And Ejbobject Classes. For Every Request From A Unique Client, Does The Container Create A Separate Instance Of The Generated Ejbhome And Ejbobject Classes?

      Answer :

      The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. while refering the EJB Object classes the container creates a separate instance for each client request. The instance pool maintainence is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is again up to the implementer.

    410. Question 410. Can The Primary Key In The Entity Bean Be A Java Primitive Type Such As Int?

      Answer :

      The primary key can't be a primitive type--use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive)

    411. Question 411. Can You Control When Passivation Occurs?

      Answer :

      The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation.

      The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic.

      Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls.

      Taken from the WebLogic 6.0 DTD -"The passivation-strategy can be either "default" or "transaction". With the default setting the container will attempt to keep a working set of beans in the cache. With the "transaction" setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).

    412. Question 412. What Is The Advantage Of Using Entity Bean For Database Operations, Over Directly Using Jdbc Api To Do Database Operations? When Would I Use One Over The Other?

      Answer :

      Entity Beans actually represents the data in a database. It is not that Entity Beans replaces JDBC API. There are two types of Entity Beans Container Managed and Bean Mananged. In Container Managed Entity Bean - Whenever the instance of the bean is created the container automatically retrieves the data from the DB/Persistance storage and assigns to the object variables in bean for user to manipulate or use them. For this the developer needs to map the fields in the database to the variables in deployment descriptor files (which varies for each vendor).

      In the Bean Managed Entity Bean - The developer has to specifically make connection, retrive values, assign them to the objects in the ejbLoad() which will be called by the container when it instatiates a bean object. Similarly in the ejbStore() the container saves the object values back the the persistance storage. ejbLoad and ejbStore are callback methods and can be only invoked by the container. Apart from this, when you use Entity beans you dont need to worry about database transaction handling, database connection pooling etc. which are taken care by the ejb container. But in case of JDBC you have to explicitly do the above features. what suresh told is exactly perfect. ofcourse, this comes under the database transations, but i want to add this. the great thing about the entity beans of container managed, whenever the connection is failed during the transaction processing, the database consistancy is mantained automatically. the container writes the data stored at persistant storage of the entity beans to the database again to provide the database consistancy. where as in jdbc api, we, developers has to do manually.

    413. Question 413. What Is Ejb Ql?

      Answer :

      EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence. EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistenceand is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.

    414. Question 414. Brief Description About Local Interfaces?

      Answer :

      EEJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE.

      Many developers are using EJBs locally -- that is, some or all of their EJB calls are between beans in a single container.

      With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned.

      Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

    415. Question 415. What Are The Special Design Care That Must Be Taken When You Work With Local Interfaces?

      Answer :

      EIt is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference.

      This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind.

      While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.

    416. Question 416. What Happens If Remove( ) Is Never Invoked On A Session Bean?

      Answer :

      In case of a stateless session bean it may not matter if we call or not as in both cases nothing is done. The number of beans in cache is managed by the container.

      In case of stateful session bean, the bean may be kept in cache till either the session times out, in which case the bean is removed or when there is a requirement for memory in which case the data is cached and the bean is sent to free pool.

    417. Question 417. How Can I Call One Ejb From Inside Of Another Ejb?

      Answer :

      EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.

    418. Question 418. What Is An Ejb Context?

      Answer :

      EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext. These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.

    419. Question 419. What Are The Two Important Tcp Socket Classes?

      Answer :

      Socket and ServerSocket.
      ServerSocket is used for normal two-way socket communication.
      Socket class allows us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.

    420. Question 420. What Technologies Are Included In J2ee?

      Answer :

      The main technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.

    421. Question 421. What Is The Difference Between Ejb And Java Beans?

      Answer :

      EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

    422. Question 422. What Is Ejb Role In J2ee?

      Answer :

      EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.

    423. Question 423. Tell Me Something About Local Interfaces.

      Answer :

      EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

    424. Question 424. What Is Enterprise Javabeans (ejb) Container?

      Answer :

      It manages the execution of enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server.

    425. Question 425. What Is In-memory Replication?

      Answer :

      The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.

    426. Question 426. What Is Ripple Effect?

      Answer :

      The process of propagating the changes in the properties of a server group during runtime to all the associated clones is called Ripple Effect.

    427. Question 427. What Is A Clone?

      Answer :

      The copies of a server group are called Clones. But unlike a Server Group Clones are associated with a node and are real server process running in that node.

    428. Question 428. What Are The Types Of Scaling?

      Answer :

      There are two types of scaling: Vertical Scaling and Horizontal Scaling.

      Vertical Scaling - When multiple server clones of an application server are defined on the same physical m/c, it is called Vertical Scaling. The objective is to use the processing power of that m/c more efficiently.

      Horizontal Scaling - When Clones of an application server are defined on multiple physical m/c, it is called Horizontal Scaling. The objective is to use more than one less powerful m/c more efficiently.

    429. Question 429. What Is A Server Group?

      Answer :

      A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.

    430. Question 430. What Is The New Basic Requirement For A Cmp Entity Bean Class In 2.0 From That Of Ejb 1.1?

      Answer :

      It must be abstract class. The container extends it and implements methods which are required for managing the relationships.

    431. Question 431. What's New In The Ejb 2.0 Specification?

      Answer :

      Following are some of the main features supported in EJB 2.0:
      1. Integration of EJB with JMS,
      2. Message Driven Beans,
      3. Implement additional Business methods in Home interface which are not specific for bean instance, EJB QL.

    432. Question 432. How Can I Access Ejb From Asp?

      Answer :

      We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun.

    433. Question 433. What Is The Relationship Between Local Interfaces And Container-managed Relationships?

      Answer :

      Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.

    434. Question 434. What Is Ejbdoclet?

      Answer :

      EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.

    435. Question 435. What Is The Difference Between Session And Entity Beans?

      Answer :

      An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)

    436. Question 436. Is It Legal To Have Static Initializer Blocks In Ejb?

      Answer :

      Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.

    437. Question 437. What Are Local Interfaces? Describe.

      Answer :

      EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

    438. Question 438. What Is Difference Between Ejb 1.1 And Ejb 2.0?

      Answer :

      The bulk of the changes in EJB 2.0 are found in the definition of a new CMP component model. It’s radically different from the old CMP model because it introduces an entirely new participant, the persistence manager, and a completely new way of defining container-managed fields, as well as relationships with other beans and dependent objects.

    439. Question 439. What Is The Difference Between Ejbcreate() And Ejbpostcreate?

      Answer :

      The purpose of ejbPostCreate() is to perform clean-up database operations after SQL INSERTs (which occur when ejbCreate() is called) when working with CMP entity beans. ejbCreate() is called before database INSERT operations. You need to use ejbPostCreate() to define operations, like set a flag, after INSERT completes successfully.

    440. Question 440. Can I Map More Than One Table In A Cmp?

      Answer :

      No, you cannot map more than one table to a single CMP Entity Bean. CMP has been, in fact, designed to map a single table.

    441. Question 441. Is Decorator An Ejb Design Pattern?

      Answer :

      No. Decorator design pattern, is the one which exhibits very low level runtime polymorphism, for the specific and single object (Instance of the class), but not for atleast for a class. It is the stuff to add specific functionality to a single & pointed object and leaves others like it unmodified. It is having close similarities like aspectJ stuff, but not with EJB stuff.

    442. Question 442. What Is The Difference Between Ear, Jar And War File?

      Answer :

      J2EE defines three types of archives:
      1. Java Archives (JAR) A JAR file encapsulates one or more Java classes, a manifest, and a descriptor. JAR files are the lowest level of archive. JAR files are used in J2EE for packaging EJBs and client-side Java Applications.
      2. Web Archives (WAR) WAR files are similar to JAR files, except that they are specifically for web applications made from Servlets, JSPs, and supporting classes.
      3. Enterprise Archives (EAR) ”An EAR file contains all of the components that make up a particular J2EE application.

    443. Question 443. What Is Re-entrant. Is Session Beans Reentrant. Is Entity Beans Reentrant?

      Answer :

      If we define the entity bean as being reentrant, multiple clients can connect to the Entity bean & execute methods within the entity bean concurrently. Container takes care of synchronization. If we define the entity bean as non-reentrant and many clients connect to it concurrently to execute a method, exception is thrown .

    444. Question 444. How Many Ejb Objects Are Created For A Bean?

      Answer :

      For a Session bean - one EJB object for one bean instance.
      For entity bean - it depends , if 2 users are accessing one row at time then one EJB object is used for both the beans other wise for each bean one EJB object.

    445. Question 445. What Is Deployment Descriptor?

      Answer :

      Deployment descriptor is a XML file. which is used to locate the web application by container.it includes the details of respective bean.

    446. Question 446. What Are The Call Back Methods In Entity Bean?

      Answer :

      1. setEntityContext().
      2. ejbCreate().
      3. ejbPostCreate().
      4. ejbActivate(). 
      5. ejbPassivate().
      6. ejbRemove().

       

    447. Question 447. What Is Local Interface. How Values Will Be Passed?

      Answer :

      An EJB can use local client view only if it is really guaranteed that other enterprise beans or clients will only address the bean within a single JVM. With local client view, you can do pass-by-reference, which means your bean, as well as the client, will work directly with one copy of the data. Any changes made by the bean will be seen by the client and vice versa. Pass-by-reference eliminates time/system expenses for copying data variables, which provides a performance advantage.

    448. Question 448. What Is Abstract Schema?

      Answer :

      Abstract schema is part of an entity bean’s deployment descriptor which defines the bean’s persistent fields and their relationship. Abstract schema is specified for entity beans with container managed persistence. We specify the name of the Abstract schema name in the deployment descriptor. The queries written in EJB QL for the finder methods references this name. The information provided in this Abstract Schema is used by the container for persistence management and relationship management.

    449. Question 449. What Is The Difference Between Find And Select Methods In Ejb?

      Answer :

      A select method can return a persistent field (or a collection thereof) of a related entity bean. A finder method can return only a local or remote interface (or a collection of interfaces).

      Because it is not exposed in any of the local or remote interfaces, a select method cannot be invoked by a client. It can be invoked only by the methods implemented within the entity bean class. A select method is usually invoked by either a business or a home method.

      A select method is defined in the entity bean class. For bean-managed persistence, a finder method is defined in the entity bean class, but for container-managed persistence it is not.

    450. Question 450. How Does A Servlet Communicate With A Jsp Page?

      Answer :

      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.

    451. Question 451. Are Enterprise Beans Allowed To Use Thread.sleep()?

      Answer :

      Enterprise beans make use of the services provided by the EJB container, such as life-cycle management. To avoid conflicts with these services, enterprise beans are restricted from performing certain operations: Managing or synchronizing threads.

    452. Question 452. Is It Possible To Specify Multiple Jndi Names When Deploying An Ejb?

      Answer :

      No. To achieve this you have to deploy your EJB multiple times each specifying a different JNDI name.

    453. Question 453. Is It Possible To Write Two Ejb's That Share The Same Remote And Home Interfaces, And Have Different Bean Classes? If So, What Are The Advantages/disadvantages?

      Answer :

      It’s certainly possible. In fact, there’s an example that ships with the Inprise Application Server of an Account interface with separate implementations for CheckingAccount and SavingsAccount, one of which was CMP and one of which was BMP.

    454. Question 454. Can An Ejb Send Asynchronous Notifications To Its Clients?

      Answer :

      Asynchronous notification is a known hole in the first versions of the EJB spec. The recommended solution to this is to use JMS, which is becoming available in J2EE-compliant servers. The other option, of course, is to use client-side threads and polling. This is not an ideal solution, but it’s workable for many scenarios.

    455. Question 455. Is There A Guarantee Of Uniqueness For Entity Beans?

      Answer :

      There is no such guarantee. The server (or servers) can instantiate as many instances of the same underlying Entity Bean (with the same PK) as it wants. However, each instance is guaranteed to have up-to-date data values, and be transactionally consistent, so uniqueness is not required. This allows the server to scale the system to support multiple threads, multiple concurrent requests, and multiple hosts.

    456. Question 456. Can A Class Be It's Own Event Handler? Explain How To Implement This.

      Answer :

      Sure. an example could be a class that extends Jbutton and implements ActionListener. In the actionPerformed method, put the code to perform when the button is pressed.

    457. Question 457. Why Does Jcomponent Have Add() And Remove() Methods But Component Does Not?

      Answer :

      Because JComponent is a subclass of Container, and can contain other components and jcomponents.

    458. Question 458. How Would You Create A Button With Rounded Edges?

      Answer :

      There’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it.

    459. Question 459. If I Wanted To Use A Solarisui For Just A Jtabbedpane, And The Metal Ui For Everything Else, How Would I Do That?

      Answer :

      In the UIDefaults table, override the entry for tabbed pane and put in the SolarisUI delegate. (I don’t know it offhand, but I think it’s "com.sun.ui.motiflookandfeel.MotifTabbedPaneUI" - anything simiar is a good answer.)

    460. Question 460. What Is The Difference Between The 'font' And 'fontmetrics' Class?

      Answer :

      The Font Class is used to render ‘glyphs’ - the characters you see on the screen. FontMetrics encapsulates information about a specific font on a specific Graphics object. (width of the characters, ascent, descent)

    461. Question 461. What Class Is At The Top Of The Awt Event Hierarchy?

      Answer :

      The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy..

    462. Question 462. Explain How To Render An Html Page Using Only Swing.

      Answer :

      Use a JEditorPane or JTextPane and set it with an HTMLEditorKit, then load the text into the pane.

    463. Question 463. How Would You Detect A Keypress In A Jcombobox?

      Answer :

      This is a trick. most people would say ‘add a KeyListener to the JComboBox’ - but the right answer is ‘add a KeyListener to the JComboBox’s editor component.’

    464. Question 464. Why Should The Implementation Of Any Swing Callback (like A Listener) Execute Quickly?

      Answer :

      Because callbacks are invoked by the event dispatch thread which will be blocked processing other events for as long as your method takes to execute.

    465. Question 465. In What Context Should The Value Of Swing Components Be Updated Directly?

      Answer :

      Swing components should be updated directly only in the context of callback methods invoked from the event dispatch thread. Any other context is not thread safe.

    466. Question 466. Why Would You Use Swingutilities.invokeandwait Or Swingutilities.invokelater?

      Answer :

      I want to update a Swing component but I’m not in a callback. If I want the update to happen immediately (perhaps for a progress bar component) then I’d use invokeAndWait. If I don’t care when the update occurs, I’d use invokeLater.

    467. Question 467. If Your Ui Seems To Freeze Periodically, What Might Be A Likely Reason?

      Answer :

      A callback implementation like ActionListener.actionPerformed or MouseListener.mouseClicked is taking a long time to execute thereby blocking the event dispatch thread from processing other UI events.

    468. Question 468. Which Swing Methods Are Thread-safe?

      Answer :

      The only thread-safe methods are repaint(), revalidate(), and invalidate()

    469. Question 469. Why Won't The Jvm Terminate When I Close All The Application Windows?

      Answer :

      The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM.

    470. Question 470. Which Method Is Used For Setting Security In Applets?

      Answer :

      setSecurityManager() method is used for setting security in applets.

    471. Question 471. What Is Jms?

      Answer :

      JMS is an acronym used for Java Messaging Service. It is Java's answer to creating software using asynchronous messaging. It is one of the official specifications of the J2EE technologies and is a key technology.

    472. Question 472. How Jms Is Different From Rpc?

      Answer :

      In RPC the method invoker waits for the method to finish execution and return the control back to the invoker. Thus it is completely synchronous in nature. While in JMS the message sender just sends the message to the destination and continues it's own processing. The sender does not wait for the receiver to respond. This is asynchronous behavior.

    473. Question 473. What Are The Advantages Of Jms?

      Answer :

      JMS is asynchronous in nature. Thus not all the pieces need to be up all the time for the application to function as a whole. Even if the receiver is down the MOM will store the messages on it's behalf and will send them once it comes back up. Thus at least a part of application can still function as there is no blocking.

    474. Question 474. Are You Aware Of Any Major Jms Products Available In The Market?

      Answer :

      IBM's MQ Series is one of the most popular product used as Message Oriented Middleware. Some of the other products are SonicMQ, iBus etc.All the J2EE compliant application servers come built with thier own implementation of JMS.

    475. Question 475. What Are The Different Types Of Messages Available In The Jms Api?

      Answer :

      Message, TextMessage, BytesMessage, StreamMessage, ObjectMessage, MapMessage are the different messages available in the JMS API.

    476. Question 476. What Are The Different Messaging Paradigms Jms Supports?

      Answer :

      Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.

    477. Question 477. What Is The Difference Between Topic And Queue?

      Answer :

      A topic is typically used for one to many messaging i.e. it supports publish subscribe model of messaging. While queue is used for one-to-one messaging i.e. it supports Point to Point Messaging.

    478. Question 478. What Is The Role Of Jms In Enterprise Solution Development?

      Answer :

      JMS is typically used in the following scenarios
      1. Enterprise Application Integration: - Where a legacy application is integrated with a new application via messaging.
      2. B2B or Business to Business: - Businesses can interact with each other via messaging because JMS allows organizations to cooperate without tightly coupling their business systems.
      3. Geographically dispersed units: - JMS can ensure safe exchange of data amongst the geographically dispersed units of an organization.
      4. One to many applications: - The applications that need to push data in packet to huge number of clients in a one-to-many fashion are good candidates for the use JMS. Typical such applications are Auction Sites, Stock Quote Services etc.

    479. Question 479. What Is The Use Of Message Object?

      Answer :

      Message is a light weight message having only header and properties and no payload. Thus if the receivers are to be notified about an event, and no data needs to be exchanged then using Message can be very efficient.

    480. Question 480. What Is The Basic Difference Between Publish Subscribe Model And P2p Model?

      Answer :

      Publish Subscribe model is typically used in one-to-many situation. It is unreliable but very fast. P2P model is used in one-to-one situation. It is highly reliable.

    481. Question 481. What Is The Use Of Bytesmessage?

      Answer :

      BytesMessage contains an array of primitive bytes in it's payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also useful where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client. Whenever you store any primitive type, it is converted into it's byte representation and then stored in the payload. There is no boundary line between the different data types stored. Thus you can even read a long as short. This would result in erroneous data and hence it is advisable that the payload be read in the same order and using the same type in which it was created by the sender.

    482. Question 482. What Is The Use Of Streammessage?

      Answer :

      StreamMessage carries a stream of Java primitive types as it's payload. It contains some conveient methods for reading the data stored in the payload. However, StreamMessage prevents reading a long value as short, something that is allowed in case of BytesMessage. This is so because the StreamMessage also writes the type information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

    483. Question 483. What Is The Use Of Textmessage?

      Answer :

      TextMessage contains instance of java.lang.String as it's payload. Thus it is very useful for exchanging textual data. It can also be used for exchanging complex character data such as an XML document.

    484. Question 484. What Is The Use Of Objectmessage?

      Answer :

      ObjectMessage contains a Serializable java object as it's payload. Thus it allows exchange of Java objects between applications. This in itself mandates that both the applications be Java applications. The consumer of the message must typecast the object received to it's appropriate type. Thus the consumer should before hand know the actual type of the object sent by the sender. Wrong type casting would result in ClassCastException. Moreover the class definition of the object set in the payload should be available on both the machine, the sender as well as the consumer. If the class definition is not available in the consumer machine, an attempt to type cast would result in ClassNotFoundException. Some of the MOMs might support dynamic loading of the desired class over the network, but the JMS specification does not mandate this behavior and would be a value added service if provided by your vendor. And relying on any such vendor specific functionality would hamper the portability of your application. Most of the time the class need to be put in the classpath of both, the sender and the consumer, manually by the developer.

    485. Question 485. What Is The Use Of Mapmessage?

      Answer :

      A MapMessage carries name-value pair as it's payload. Thus it's payload is similar to the java.util.Properties object of Java. The values can be Java primitives or their wrappers.

    486. Question 486. What Is The Difference Between Bytesmessage And Streammessage??

      Answer :

      BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one contiguous stream of bytes. While the StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage allows data to be read using any type. Thus even if your payload contains a long value, you can invoke a method to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

    487. Question 487. What Is Point-to-point Messaging?

      Answer :

      With point-to-point message passing the sending application/client establishes a named message queue in the JMS broker/server and sends messages to this queue. The receiving client registers with the broker to receive messages posted to this queue. There is a one-to-one relationship between the sending and receiving clients.

    488. Question 488. What Is The Advantage Of Persistent Message Delivery Compared To Nonpersistent Delivery?

      Answer :

      If the JMS server experiences a failure, for example, a power outage, any message that it is holding in primary storage potentially could be lost. With persistent storage, the JMS server logs every message to secondary storage. (The logging occurs on the front end, that is, as part of handling the send operation from the message producing client.) The logged message is removed from secondary storage only after it has been successfully delivered to all consuming clients .

    489. Question 489. Give An Example Of Using The Publish/subscribe Model.

      Answer :

      JMS can be used to broadcast shutdown messages to clients connected to the Weblogic server on a module wise basis. If an application has six modules, each module behaves like a subscriber to a named topic on the server.

    490. Question 490. How Is A Java Object Message Delivered To A Non-java Client?

      Answer :

      It is according to the specification that the message sent should be received in the same format. A non-java client cannot receive a message in the form of java object. The provider in between handles the conversion of the data type and the message is transferred to the other end.

    491. Question 491. What Is Mdb And What Is The Special Feature Of That?

      Answer :

      MDB is Message driven bean, which very much resembles the Stateless session bean. The incoming and out going messages can be handled by the Message driven bean. The ability to communicate asynchronously is the special feature about the Message driven bean.

    492. Question 492. What Are The Types Of Messaging?

      Answer :

      There are two kinds of Messaging.

      Synchronous Messaging: Synchronous messaging involves a client that waits for the server to respond to a message.

      Asynchronous Messaging: Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server.

    493. Question 493. What Are The Core Jms-related Objects Required For Each Jms-enabled Application?

      Answer :

      Each JMS-enabled client must establish the following:
      • A connection object provided by the JMS server (the message broker)
      • Within a connection, one or more sessions, which provide a context for message sending and receiving
      • Within a session, either a queue or topic object representing the destination (the message staging area) within the message broker
      • Within a session, the appropriate sender or publisher or receiver or subscriber object (depending on whether the client is a message producer or consumer and uses a point-to-point or publish/subscribe strategy, respectively) Within a session, a message object (to send or to receive)

    494. Question 494. What Is The Use Of Load And Require In Ruby?

      Answer :

      A method that loads and processes the Ruby code from a separate file, including whatever classes, modules, methods, and constants are in that file into the current scope. load is similar, but rather than performing the inclusion operation once, it reprocesses the code every time load is called.

    495. Question 495. What Function Converts All Html Special Symbols To Html Entities In Ruby?

      Answer :

      This function ae_some_html converts all HTML special symbols to HTML entities.

    496. Question 496. What Is The Log That Has To Seen To Check For An Error In Ruby Rails?

      Answer :

      Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you're having a problem, do have a look at what these logs are saying. On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application's execution.

    497. Question 497. What Is The Scope Of A Local Variable In Ruby?

      Answer :

      A new scope for a local variable is introduced in the toplevel, a class (module) definition, a method defintion. In a procedure block a new scope is introduced but you can access to a local variable outside the block.

      The scope in a block is special because a local variable should be localized in Thread and Proc objects. while, until, and for are control structures and the scope is shared with the outside of these structures. loop is a method and the appended block introduces a new scope.

    498. Question 498. What Is The Use Of Global Variable $ In Ruby?

      Answer :

      If you declare one variable as global we can access any where, as class variable.

    499. Question 499. Where Does The Start_tabnav Gets Informations For Tabs Rendering In Ruby Rail?

      Answer :

      <%= start_tabnav :main %>
      The :main Symbol let the start_tabnav method know to look for a special MainTabnav class where all the magic happens.

    500. Question 500. What Type Messaging Is Provided By Jms?

      Answer :

      Both synchronous and asynchronous are provided by JMS.

    501. Question 501. What Are The Different Parts Of A Jms Message ?

      Answer :

      A JMS message contains three parts. a header, an optional properties and an optional body.

    502. Question 502. What Is The Role Of The Jms Provider?

      Answer :

      The JMS provider handles security of the messages, data conversion and the client triggering. The JMS provider specifies the level of encryption and the security level of the message, the best data type for the non-JMS client.

    503. Question 503. What Is The Difference Between Byte Message And Stream Message?

      Answer :

      Bytes Message stores data in bytes. Thus the message is one contiguous stream of bytes. While the Stream Message maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. Bytes Message allows data to be read using any type. Thus even if your payload contains a long value, you can invoke a method to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the Stream Message. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.

    504. Question 504. What Is Byte Message ?

      Answer :

      Byte Messages contains a Stream of uninterrupted bytes. Byte Message contains an array of primitive bytes in it's payload. Thus it can be used for transfer of data between two applications in their native format which may not be compatible with other Message types. It is also be useful where JMS is used purely as a transport between two systems and the message payload is opaque to the JMS client.

    505. Question 505. What Is Object Message ?

      Answer :

      Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. sot both the applications must be Java applications.

    506. Question 506. What Is Text Message?

      Answer :

      Text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.

    507. Question 507. What Is Map Message?

      Answer :

      map message contains name value Pairs. The values can be of type primitives and its wrappers. The name is a string.

    508. Question 508. What Is Stream Message ?

      Answer :

      Stream messages are a group of java primitives. It contains some convenient methods for reading the data. However Stream Message prevents reading a long value as short. This is so because the Stream Message also writes the type information along with the value of the primitive type and enforces a set of strict conversion rules which actually prevents reading of one primitive type as another.

    509. Question 509. What Is The Difference Between Queue And Topic ?

      Answer :

      A topic is typically used for one to many messaging , while queue is used for one-to-one messaging. Topic .e. it supports publish subscribe model of messaging where queue supports Point to Point Messaging.

    510. Question 510. What Is Messaging?

      Answer :

      Messaging is a mechanism by which data can be passed from one application to another application.

    511. Question 511. Explain About The Programming Language Ruby?

      Answer :

      Ruby is the brain child of a Japanese programmer Matz. He created Ruby. It is a cross platform object oriented language. It helps you in knowing what your code does in your application. With legacy code it gives you the power of administration and organization tasks. Being open source, it did go into great lengths of development.

    512. Question 512. Explain About Class Libraries In Ruby?

      Answer :

      Ruby has a strong set of class libraries and it covers from a variety of domains such as thread programming, domains and data types. Also ruby is a new language and it also has additional libraries coming every day. Many of the new languages which do exist have huge libraries because of their age.

    513. Question 513. Explain About Portability?

      Answer :

      Ruby language can be ported to many platforms. Ruby programs can be ported to many platforms without any modification to the source code. This feature made the language very useful and highly used by many programmers worldwide. Some of the platforms used are DOS, UNIX, WINDOWS, etc.

    514. Question 514. Explain About Garbage Collection Feature Of Ruby?

      Answer :

      Ruby is an object oriented language and every object oriented language tends to allocate many objects during execution of the program. Ruby deletes unallocated and unused objects automatically. This feature can be controlled by applying proper syntax and program through ruby.

    515. Question 515. Explain About The Command Line Options?

      Answer :

      Ruby`s language is executed from the command line like most of the scripting languages. Programming and behavior language environment can be controlled from the interpreter itself. Some of the commands which are used are as follows –d, -h, -e prog, -v, -T, -r lib, etc.

    516. Question 516. Explain About Environment Variables Present In Ruby?

      Answer :

      Following are some of the environment variables used to control the behavior programming of ruby. While programming ENV object lists some of the current variables. RUBYLIB path searches for libraries. Make sure that you separate each path with colons. RUBYOPT passes command line options to Ruby interpreter. There are many more which can be obtained by searching the huge pool of library.

    517. Question 517. Explain About Operators In Ruby?

      Answer :

      Like all the modern languages Ruby supports many different operators to its credit. Most of the operators in Ruby are in fact methods due to the object oriented nature of the language. This feature gives Ruby an edge over its competitors. Semantics of these operators can be changed due to the object oriented nature of the language.

    518. Question 518. Explain About The Defined Operator?

      Answer :

      Define operator defines whether a passed expression is defined or not. If the expression is defined it returns the description string or null if the expression is not defined. If a variable is defined it gets initialized. If method_call is defined as true then method also gets defined. This is also the same case with super and yield.

    519. Question 519. Explain About Methods?

      Answer :

      Methods in ruby basically perform two functions, named operation and the code present in the class which does a specific function. In Ruby all your algorithms live in methods which inturn is present on objects. Ruby does not have any provision for functions. Code present in Ruby is always a method of some object. Behind the scenes ruby gives you the flexibility to work with methods as functions if you are considering working with other languages.

    520. Question 520. Explain About Normal Method Class?

      Answer :

      This function calls a method and it can take any number of arguments and expr. Make sure that you put an asterisk or an ampersand before the expression. Last expr argument can be declared with a hash without any braces. If you want to increase the size of the array value then make sure that you put an asterisk before expression. “::” can be used to separate the class from methods.

    521. Question 521. Explain About Ruby Names?

      Answer :

      Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make sure that you follow the name by name characters.

    522. Question 522. Explain About Variables?

      Answer :

      There are four different types of variables they are local, instance, global, and class. Variables can be used in the program without any declaration and they can contain data of any type. A local variable contains lower case characters followed by name characters. Instance variable starts with a @ sign followed by name characters.

    523. Question 523. Explain About Class Variable And Global Variable?

      Answer :

      A class variable starts with an @@ sign which is immediately followed by upper or lower case letter. You can also put some name characters after the letters which stand to be a pure optional. A class variable can be shared among all the objects of a class. A single copy of a class variable exists for each and every given class.
      To write a global variable you start the variable with a $ sign which should be followed by a name character. Ruby defines a number of global variables which also include other punctuation characters such as $_ and $-k.

    524. Question 524. How Does Ruby Deal With Extremely Large Numbers?

      Answer :

      Unlike other programming languages ruby deals with extremely large numbers it doesn’t have any barriers. There is no limit on the extent of limit of number usage. Ruby performs this function with two different classes they are fixnum and bignum. Fixnum represents easily managed small numbers and bignum represents big numbers. Ruby entirely handles the functioning of these two classes which leaves a programmer to concentrate on his arithmetic operations.

    525. Question 525. Explain About Float, Dig And Max?

      Answer :

      Float class is used whenever the function changes constantly. It acts as a sub class of numeric. They represent real characters by making use of the native architecture of the double precision floating point.
      Max is used whenever there is a huge need of Float.
      Dig is used whenever you want to represent a float in decimal digits.

    526. Question 526. Explain About Interpolation?

      Answer :

      Interpolation is a very important process in Ruby. Interpolation is the process of inserting a string into a literal. There is only one way in which you can interpolate a string into a literal by placing a Hash (#) within {} open and close brackets. This refers to a new name to by referring to the copy of the original method.

    527. Question 527. Explain About Ruby Code Blocks?

      Answer :

      Ruby code blocks form an important part of ruby and are very fun to use. With the help of this feature you can place your code between do-end and you can associate them with method invocations and you can get an impression that they are like parameters. They may appear near to a source of the code and adjacent to a method call. The code is not executed during the program execution but it is executed when the context of its appearance is met or when it enters a method.

    528. Question 528. What Is Jboss?

      Answer :

      JBoss is a popular open source application server based on JEE technology. Being JEE based, the JBoss supports cross-platform java applications. It was embedded with Apache Tomcat web server. It runs under any JVM of 1.3 or later versions. JBoss supports JNDI, Servlet/JSP (Tomcat or Jetty), EJB, JTS/JTA, JCA, JMS, Clustering (JavaGroups), Web Services (Axis), and IIOP integration (JacORB).

    529. Question 529. What Is Jta?

      Answer :

      Java Transaction API is a standard between the transaction manager and the entities participated in the distributed transaction system. These entities are transaction manager, the application server and transactional applications. JTA allows the applications to perform distributed transactions between one or more systems connected to the network. The database access power is greatly increased by supporting JTA in a JDBC driver.

      The resource manager can be viewed as a RDBMS. This component handles the actual database management. The communication channel is the resource adapter which is a JDBC driver. For a specific enterprise database, the resource manager local transaction is performed for a single transaction.

    530. Question 530. How Can You Start A Jta Transaction From A Servlet Deployed On Jboss ?

      Answer :

      JBoss registers in the JNDI tree a JTA UserTransaction Object which can be user to manage a distributed transaction.

    531. Question 531. Which Component Handles Cluster Communication In Jboss ?

      Answer :

      The JGroups framework provides services to enable peer-to-peer communications between nodes in a cluster. It is built on top a stack of network communication protocols that provide transport, discovery, reliability and failure detection, and cluster membership management services.

    532. Question 532. Is It Possible To Put A Jboss Server Instance Into Multiple Cluster At The Same Time ?

      Answer :

      It is technically possible to put a JBoss server instance into multiple clusters at the same time, this practice is generally not recommended, as it increases the management complexity.

    533. Question 533. What's Jboss Cache In Short ?

      Answer :

      JBossCache enables easy distribution of datasets across your computing environments. It is based on JGroups and enables clustering and high availability of that data. You may choose to distribute the data with JBoss Messaging to move it where it is needed for computation or event-based programming.

    534. Question 534. What Do You Know About Seam ?

      Answer :

      Built on the standards JavaServer Faces and EJB 3.0, JBoss Seam unifies component and programming models and delivers a consistent and powerful framework for rapid creation of web applications with Java EE 5.0. Seam simplifies web application development and enables new functionality that was difficult to implement by hand before, such as stateful conversations, multi-window operation, and handling concurrent fine-grained AJAX requests. Seam also unifies and integrates popular open source technologies like Facelets, Hibernate, iText, and Lucene.

    535. Question 535. Does Seam Run On Other Application Servers Besides Jboss ?

      Answer :

      Seam runs beautifully on other application servers - just like everything else the Hibernate team does, this is not a JBoss-only thing.

    536. Question 536. What's Jboss Jbpm ?

      Answer :

      JBoss jBPM is a platform for process languages. At the base there is a java library to define and execute graphs. The actual process constructs like e.g. send email, user task and update database are defined on top of this. Every process language is made up of a set of such process constructs. And that is what is pluggable in this base library. On top of the JBoss jBPM base library, there are implemented several process languages as a set of process constructs: jPDL, BPEL and SEAM pageflow:

      • jPDL is a process language with a clean interface to Java and very sophisticated task management capabilities. There is no standard for Java process languages, so it is proprietary.
      • BPEL is a service orchestration language. As said before, in BPEL, you can write new services as a function of other services. This is typically a component of an Enterprise Service Bus (ESB).
      • SEAM pageflow is a language that allows for the graphically define the navigation between pages in a SEAM web application.

    537. Question 537. Can I Run Seam Outside Of Jboss As?

      Answer :

      Yes, you can run Seam applications in plain Tomcat 5.5+ or in the Sun GlassFish application server. To run Seam application in Tomcat, you need a number of additional library files and a few configuration files to bootstrap the JBoss EJB3 inside Tomcat. Please refer to the deploy.tomcat ANT build target for the Seam booking example (in theexamples/booking directory of the Seam distribution) for more on how to build a Tomcat WAR for Seam applications. Refer to this blog post on how to run Seam in Sun's Glassfish application server.

    538. Question 538. Can I Run Seam In A J2ee Environment?

      Answer :

      Yes, as of Seam 1.1, you can use Seam in any J2EE application server, with one caveat: you will not be able to use EJB 3.0 session beans. However, you can use either Hibernate or JPA for persistence, and you can use Seam JavaBean components instead of session beans.

    539. Question 539. Can I Run Seam With Jdk 1.4 And Earlier?

      Answer :

      No, Seam only works on JDK 5.0 and above. It uses annotations and other JDK 5.0 features.

    540. Question 540. Where Can I Find Seam Examples And Documentation?

      Answer :

      The source code and build script of all Seam example applications are included in the examples directory of theSeam distribution. Seam documentation is available here.

    541. Question 541. Where Can I Ask Questions And Make Suggestions About Seam?

      Answer :

      Please use the Seam User's discussion forum for user questions.

    542. Question 542. Are There Books About Seam?

      Answer :

      Yes, Prentice Hall's "JBoss Seam: Simplicity and Power Beyond Java EE 5.0" is a comprehensive guide for Seam written by JBoss insiders.

    543. Question 543. Can I Use Ajax With Seam?

      Answer :

      Yes, Seam provides excellent support for AJAX. First, Seam supports the ICEfaces and Ajax4JSF Ajax component libraries for JSF. If you prefer a more "old fashioned" approach, Seam provides a complete JavaScript remoting framework which lets you call Seam components and subscribe to JMS topics directly from the client. Please refer to the Seam remoting example application on how to use AJAX remoting to implement a chat room.
      Finally, Seam's concurrency model is designed especially for use with Ajax.

    544. Question 544. Can I Unit Test Seam Applications Without Starting The Application Server?

      Answer :

      Yes, Seam provides its own integration test framework based on TestNG You can easily mock all Seam services using those facilities without ever loading an application server or a database.

    545. Question 545. What's The Difference Between Hibernate And Ejb 3 ? Don't You Think Ejb 3 Is Just A Clone Of Hibernate ?

      Answer :

      The perception of EJB3 as being a simple clone of Hibernate is primarily based on developer familiarity with Hibernate and a similarity of naming, as well as common purpose, and that Hibernate is morphing itself into an EJB3 implementation based on the work going into the specification, not the other way around.

      EJBs are supposed to be components, in the sense that they're not just one class, but a set of classes, descriptors and usage and management contracts. All of this in order to allow a container (JBoss, Weblogic, etc.) to provide services to those components, and to be able to reuse and distribute this components. This services are, among others, transactions, concurrent access control, security, instance pooling, etcetera.

      Hibernat is "just" an ORM (Object/Relational Mapping) tool. Quick and dirty, this means you can store an object tree belonging to an class hierarchy in a relational DB without writing a single SQL query. Quite cool, IMO. But no transaction control, no instance pooling, no concurrency control, and certainly no security.

    546. Question 546. Which Hibernate Object Wraps The Jdbc Connection ?

      Answer :

      The Session interface wraps a JDBC Connection. This interface is a single threaded object which represents a single unit of work with application and persistent database. It's retrieved by the SessionFactory's open Session() method.

    547. Question 547. Ok, Is The Session Factory Thread Safe?

      Answer :

      Yes: that is many threads can access it cuncurrentely and request for sessions. It holds cached data that has been read in one unit of work and may be reused in a future unit of work. Good practice is to create it when the application is initialized.

    548. Question 548. What If You Need To Span Your Transaction Across Multiple Servlet Invocations ?

      Answer :

      You can't with a Servlet. A JTA transaction must start and finish within a single invocation (of the service() method). You should consider using a Stateful SB. In a SFSB with a JTA transaction, the association between the bean instance and the transaction is retained across multiple client calls.

    549. Question 549. What Are The Differences Between Ejb 3.0 And Ejb 2.0 ?

      Answer :

      EJBs are now plain old Java objects (POJO) that expose regular business interfaces (POJI), and there is no requirement for home interfaces.

      • Use of metadata annotations, an extensible, metadata-driven, attribute-oriented framework that is used to generate Java code or XML deployment descriptors.
      • Removal of the requirement for specific interfaces and deployment descriptors (deployment descriptor information can be replaced by annotations).
      • Interceptor facility to invoke user methods at the invocation of business methods or at life cycle events.
      • Default values are used whenever possible (“configuration by exception” approach).
      • Reduction in the requirements for usage of checked exception.
      • A complete new persistence model (based on the JPA standard), that supersedes EJB 2.x entity beans.

    550. Question 550. What Is The Diffrence Between A Local-tx-datasource And A Xa-datasource? Can You Use Transactions In Both ?

      Answer :

      A local-tx-datasource identifies a data source that uses transactions, even distributed trans actions within the local application server, but doesn’t use distributed transactions among multiple application servers. An xa-datasource on the other hand identifies a data source that uses distributed transaction among multi-ple application servers.

    551. Question 551. What Do You Need To Set-up A Cluster With Jboss ?

      Answer :

      Basically starting JBoss with the “all” configuration contains everything needed for clustering: It has all the libraries for clustering:
      • JGroups.jar, jboss-cache.jar
      • Clustered beans (cluster-service.xml)
      • HA-JNDI
      • HTTP session replications (tc5-cluster-service.xml)
      • Farming
      • HA-JMS.

    552. Question 552. What Optimization Could I Use If The Ejb Container Is The Only Point Of Write Access To The Database ?

      Answer :

      You could activate the "Commit Option A" that is the container caches entity bean state between transactions. This option assumesthat the container has exclusive access to the persistentstore and therefore it doesn’t need to synchronizethe in-memory bean state from the persistent store at the beginning of each transaction.

    553. Question 553. Explain The Difference Between Nil And False In Ruby?

      Answer :

      False is a boolean datatype
      Nil is not a data type

    554. Question 554. Explain The Use Of Global Variable $ In Ruby?

      Answer :

      If you declare one variable as global we can access any where, where as class variable visibility only in the class.

    555. Question 555. What Is The Use Of Super In Ruby Rails?

      Answer :

      ► Ruby uses the super keyword to call the superclass implementation of the current method.
      ► Within the body of a method, calls to super acts just like a call to that original method.
      ► The search for a method body starts in the superclass of the object that was found to contain the original method.
      def url=(addr)
      super (addr.blank? || addr.starts_with?('http')) ? addr : http://#{addr}
      end

    556. Question 556. Interpolation Is A Very Important Process In Ruby, Comment?

      Answer :

      ► Interpolation is the process of inserting a string into a literal.
      ► You can interpolate a string into a literal by placing a Hash (#) within {} open and close brackets.
      ► This refers to a new name to by referring to the copy of the original method.

    557. Question 557. Describe The Environment Variables Present In Ruby.

      Answer :

      RUBYOPT
      Additional command-line options to Ruby; examined after real command-line options are parsed ($SAFE must be 0).

      RUBYLIB
      Additional search path for Ruby programs ($SAFE must be 0).

      RUBYPATH
      With -S option, search path for Ruby programs (defaults to PATH).

      RUBYSHELL
      Shell to use when spawning a process; if not set, will also check SHELL or COMSPEC. DLN_LIBRARY_PATH Search path for dynamically loaded modules.

      RUBYLIB_PREFIX
      (Windows only) Mangle the RUBYLIB search path by adding this prefix to each component.

    558. Question 558. Explain The Concepts And Capabilities Of Garbage Collection Feature Of Ruby?

      Answer :

      ► Ruby is an object oriented language and every object oriented language tends to allocate many objects during execution of the program.
      ► Ruby deletes unallocated and unused objects automatically.
      ► This feature can be controlled by applying proper syntax and program through ruby.

    559. Question 559. Describe Class Libraries In Ruby?

      Answer :

      ► The Ruby standard library extends the foundation of the Ruby built-in library with classes and abstractions for a variety of programming needs, including network programming, operating system services, threads, and more.
      ► These classes provide flexible capabilities at a high level of abstraction, giving you the ability to create powerful Ruby scripts useful in a variety of problem domains.

    560. Question 560. What Is Rails?

      Answer :

      ► Ruby on Rails is an open source web application framework for the Ruby programming language.
      ► It is used with an Agile development methodology that is used by web developers for rapid development.

    561. Question 561. Why Ruby On Rails?

      Answer :

      There are lot of advantages of using ruby on rails
      1. DRY Principal
      2. Convention over Configuration
      3. Gems and Plugins
      4. Scaffolding
      5. Pure OOP Concept
      6. Rest Support
      7. Rack support
      8. Action Mailer
      9. Rpc support
      10. Rexml Support etc..

    562. Question 562. How May Messaging Models Do Jms Provide For And What Are They?

      Answer :

      JMS provide for two messaging models, publish-and subscribe and point-to-point queuing.

    563. Question 563. Are We Allowed To Change The Transaction Isolation Property In Middle Of A Transaction?

      Answer :

      No. You cannot change the transaction isolation level in the middle of transaction.

    564. Question 564. Should Synchronization Primitives Be Used On Bean Methods?

      Answer :

      No. The EJB specification specifically states that the enterprise bean is not allowed to use thread primitives. The container is responsible for managing concurrent access to beans at runtime

    565. Question 565. Is Method Overloading Allowed In Ejb?

      Answer :

      Yes you can overload methods

    566. Question 566. What Is The Default Transaction Attribute For An Ejb?

      Answer :

      There is no default transaction attribute for an EJB.  In weblogic, the default transaction attribute for EJB is SUPPORTS.

    567. Question 567. Is It Possible To Stop The Execution Of A Method Before Completion In A Sessionbean?

      Answer :

      Stopping the execution of a method inside a Session Bean is not possible without writing code inside the Session Bean. This is because you are not allowed to access Threads inside an EJB.

    568. Question 568. What Do You Understand By The Term Network?

      Answer :

      A network is a set of computers and peripherals, such as modems and printers, that are physically connected together. A particular network has a unique set of hardware and software that enables various computers and peripherals to communicate. The power of networks enables computers to share resources. For example, a small computer on a network can access and use other computers that are much more powerful.

      One Java design goal was to support the development of complex programs that are small, bug free and easy to understand. One of the areas in which Java's creators have succeeded with this goal is in the Network class. In other programming languages, performing the simplest network task can require pages of codes. With Java, in contrast, many of these tasks have been reduced to a single statement. For example, opening a file across a network in Java is not much more complicated than opening a local file. Because of this ease in programming, Java should make network programming common place.

    569. Question 569. Explain The Generic Term Internet.

      Answer :

      The generic term internet refers to a network of networks. The Internet is just one particular internet. However, it is the ultimate network of networks. Because you are interested in Java, you have certainly used a Web browser to surf the Internet. As you probably know, a Web browser is only one of many Internet applications.
      Other Internet applications include e-mail, network news, file transfers and telnet. Other than e-mail, some users on the Web aren't aware of these other applications. Each has played an important role in getting the Internet where it is today. For example, network news, also called Usenet, is still a popular way for users to exchange information using a bulletin-board like media. Usenet lets users discuss a wide range of topics.
      In the early days, the Internet was developed by the academic community. Usenet and e-mail were ideal for researchers to communicate with each other across the country. Today, Usenet topics cover all aspects of human internet and e-mail is an indispensable business tool.

    570. Question 570. What Does Tcp/ip Stand For And What Is Its Use?

      Answer :

      To communicate across the Internet, a program must follow a specific set of rules, called protocols. These protocols may specify the size and format of the program's electronic messages or how programs synchronize messages. In short, who sends the first message and what type of reply the sender expects.

      The primary protocol on the Internet is TCP/IP (the Transmission Control Protocol/Internet Protocol), The TCP/IP protocols define the rules that computers and peripherals on the Internet use to communicate. For example, TCP/IP protocols defines how a program finds a particular device on a network, the format the program must use to send the device data, how the program should check for errors and so on. 

    571. Question 571. What Do You Understand By The Term Client-server Application?

      Answer :

      Networks make many new types of applications possible because a single machine no longer has to do everything. Within a network, some computers, called servers, perform specialized tasks on behalf of other programs. A program that uses a server is a client.
      A server is simply a computer that runs a specific program continuously whose role purpose is to provide a service to other programs. A client, on the other hand, is a program that receives service from the server. For example, a print server is a software program that waits until other programs (the clients) send their files to print. The server then prints the files on behalf of the client. There are many types of servers across the Internet with which you may be familiar, such as mail servers, file servers and of course, World Wide (or HTTP) servers.

    572. Question 572. What Are Protocols? What Are They Used For?

      Answer :

      To write a client-server application, you must create two programs: the client and the server. Within these programs, you must define how the two applications will communicate—the rules each program must follow. As you have learned, the rules the client and server program must follow to communicate are protocols. In short, protocols define how client-server programs interact.
      Most programmers implement protocols using a series of layers, where each layer deals with a particular task. For example, the lowest layer might deal with the actual communication across the network hardware. The next layer might check the bits sent across the network for communication errors. Likewise, the next layer might package the bits into a message format your program understands. Client-server applications use upper-layer protocols that are normally based on a specific application (such as printing a file or transferring a file). The upper-layer protocol defines a strict set of rules on how two applications exchange data.

    573. Question 573. What Is The Relationship Between Servers And Ports?

      Answer :

      As you have learned, an IP address identifies a computer on the Internet. You also learned that a port number identifies a process (a program) that is running on a computer. As it turns out, programs use port numbers for client and server applications. Because IP addresses are unique and on a given computer, port numbers are unique, a port number combined with an IP address completely distinguishes an application running on the Internet. The combination of port number and IP address yields a socket and provides an end point of a communication path. As you will learn the same application IP address and port number may use multiple sockets, each having a different value. Thus, a socket's value combines an application-specific value with the IP address and port number.

    574. Question 574. What Is The Applet Client Restriction?

      Answer :

      Java places restrictions on an applet. One restriction is that an applet cannot make a Socket connection to any server other than the one it came from (the server from which the browser downloaded the applet). Therefore, you cannot, for example, make a generic mail tool applet unless you plan to support it with SMTP and POP3 mail servers on the same machine that stores the applet. Also, because of this restriction, you cannot have two applets connect directly together, so that two users can play a game. Consequently, you should always take applet restrictions into consideration when you design a Java-server application with applets.

    575. Question 575. Why Servers Should Be Multithreading? Explain.

      Answer :

      As you know, multithreading lets your Java program perform tasks in parallel. A server is a great example of a program that should be multithreaded. If a server has a single thread of control, only one client can interact with the server at any one time. If you write your server to support multithreading, the server can process many client-server connections simultaneously.

    576. Question 576. Why A Client Should Be Multithreading? Explain.

      Answer :

      In many types of client applications, support for multiple threads is also useful. A Web browser, for example, is a multithreaded application. Within a browser, you can have multiple windows open and perform multiple downloads at the same time. To perform each download operation, the browser simply starts a new thread which preforms the corresponding processing.
      When your program writes information to or receives information from a stream, a program that uses a single thread of control must wait for the I/O operation to complete—a process called I/O blocking. If you use multiple threads to perform the stream read and write operations, your application can continue to perform other operations. When you write client applications, take advantage of Java's multithreading to make your programs interface more user-friendly and more responsive.

    577. Question 577. What Is Chat Area? Explain.

      Answer :

      Ever since the first computers were connected, people have been using them to talk. A chat area is an interface that lets a group of people talk by typing messages. Like all Internet-based program, chat programs must follow a specific protocol: Specifically, chat programs rely on the Internet Relay Chat (IRC) protocol. However, chatting on a Web page has been ad-hoc at best, until Java.
      With Java, a Web page can have a fully featured chat area. Features such as instant messages and membership rooms are not difficult to implement. Due to the applet restrictions, chat applets on the same page will have to communicate through a server on the computer where they reside.

    578. Question 578. What Are The Applet's Life Cycle Methods? Explain Them.

      Answer :

      Following are the methods in the life cycle of an Applet:
      (a) init() method—called, when an applet is first loaded. This method is called only once in the entire cycle of an applet. This method usually initializes the variables to be used in the applet.
      (b) start() method—called each time an applet is started.
      (c) paint() method—called when the applet is minimized or refreshed. This method is used for drawing different strings, figures and images on the applet window.
      (d) stop() method—called when the browser moves off the applet's page.
      (e) destroy() method—called when the browser is finished with the applet.

    579. Question 579. Which Classes And Interfaces Does Applet Class Consist?

      Answer :

      Applet class consists of a single class, the Applet class and three interfaces: AppletContext, AppletStub and AudioClip.

    580. Question 580. What Are The Applet's Information Methods?

      Answer :

      The following are the Applet's information methods:

      • getAppletInfo() method: Returns a string describing the applet, its author, copyright information, etc.
      • getParameterInfo() method: Returns an array of string describing the applet's parameters.

    581. Question 581. How Does Ejb Invocation Happens?

      Answer :

      Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).

    582. Question 582. What Is Clustering? What Are The Different Algorithms Used For Clustering?

      Answer :

      Clustering is grouping machines together to transparently provide enterprise services. The client does not know the difference between approaching one server or approaching a cluster of servers. Clusters provide two benefits: scalability and high availability.

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Adv Java Tutorial