Question 1. Explain Ejb In Brief.
EJB is a popular for growing server aspect in JAVA. It specifies settlement among components and alertness servers that allows additives to run on server. They are specifically for complex serer aspect operations like executing complicated algorithm or excessive quantity enterprise. EJB provides the software layer good judgment, also known as as center tier. It gives a general specifications-based totally way to develop and deploy agency-magnificence gadget.
Question 2. When Was Ejb Developed?
EJB become developed by IBM in 1997.
Adv Java Interview Questions
Question three. What Happens If Remove( ) Is Never Invoked On A Session Bean?
Two conditions want to be taken under consideration:
take away() invoked for a stateless session: In this situation it is able to now not depend whether we use get rid of() or not as in either case, not anything is accomplished. The control of the quantity of beans in cache is completed by means of field.
Take away() invoked for a stateful session: Here,
The bean is probably kept in cache until the consultation is timed out and then it's miles removed or
When there may be reminiscence requirement, the statistics is cached and bean is sent to unfastened pool.
Question 4. Define Context?
This is a technique of binding a name to a specific item with the aid of giving an interface like javax.Naming.Context
Adv Java Tutorial
Question five. What Is Ejb Client Jar File?
An EJB purchaser JAR document is an non-obligatory JAR file that can contain all the class documents that a customer program needs to use the customer view of the company beans which might be contained in the EJB JAR document. If making a decision now not to create a client JAR file for an EJB module, all of the client interface training may be inside the EJB JAR record.
J2EE Interview Questions
Question 6. Who Took Over Ejb?
EJB became taken over by means of Sun Microsystems in 1999.
Question 7. What Are Create Methods Of Entity Bean?
The create() technique is used to insert records into the database by means of developing a new instance of CMP entity bean. The creation methods look like this:
The introduction strategies are connected at run time. The field delegates the invocation to those techniques when the create() is invoked on home interface. These strategies create Entity beans according to programmer specific parameters and situations.
J2EE Tutorial Core Java Interview Questions
Question 8. Is Ejbcreate () Method Mandatory While Defining A Session Bean?
EjbCreate () as being a part of the bean’s lifecycle, therefore, it is not mandatory for ejbCreate () technique to be gift and there can be no mistakes returned via the compiler.
Question nine. Describe The Life Cycle For Stateful Beans.
Between the consumer and the session bean, the nation of the communique can be maintained the usage of a stateful consultation bean. The instance variables contain a nation simplest at some stage in the invocation by way of a customer approach.
It implements ‘javax.Ejb.SessionBean’ interface and is deployed with the declarative characteristic ‘stateful’.
They have instance fields that may be initialized and modified with the aid of the customer with every method invocation. The bean can use the conversational states as its commercial enterprise method techniques.
JSP Interview Questions
Question 10. Enlist The Enterprise Beans Types?
Session Beans: Expanded as “Stateful”,”Stateless” and “Singleton”, A Remote or Local interface is used to get right of entry to the EJB files.
Message Driven Beans (MDB): Asynchronous execution by way of messaging paradigm is supported.
Core Java Tutorial
Question eleven. What Is Session Bean?
Session beans are used to defend the purchaser from the complexity of the commercial enterprise logic. They provide get right of entry to to important temporary enterprise services. They are created by means of the customer filing the question to the database and exist so long as the customer server consultation exists.
Session bean additives enforce the javax.Ejb.SessionBean interface. Client invokes the techniques at the session beans to get entry to the utility inside the server.
Java-Springs Interview Questions
Question 12. Which Is More Beneficial: Cmp Or Bmp?
When “one to 1” mapping is involved, and the data is saved persistently is nearby database, CMP is preferred. But whilst no “one to at least one” mapping is there and data is retrieved from numerous tables having a complicated question, Bean Managed Persistence is used.
Adv Java Interview Questions
Question 13. What Is Ejb Ql?
EJB QL stands for Enterprise Java Beans - Query Language. It became delivered in the EJB 2.Zero specification. QL provides navigation throughout network of EJBs and dependent gadgets which are described by way of container managed endurance. Persistence is the capacity to shop the present day state of a bean. EJB QL is portable across bins and persistence managers.
Finder Methods: These are described within the domestic interface of an entity bean and which return entity gadgets.
Select techniques: These aren't exposed to the consumer. However, those are utilized by bean vendors to choose staying power values or entity gadgets associated with entity bean which the query is described on.
Question 14. Enlist The Declarative Transaction Types?
Question 15. What Is Lazy Loading?
Heavy weight utility devour quite a few time whilst loading the plug-ins. In lazy loading technique, the plug-ins which might be wished at that precise time are loaded and instantiated. This boosts up the overall performance as handiest the plug-ins which might be used are loaded. This additionally guarantees the efficiency and quickens the preliminary load time of the applications. Applications like Eclipse use this method. In different words, the intention of lazy loading is to devote memory best whilst it's far honestly vital.
JMS(Java Message Service) Interview Questions
Question 16. Differentiate ‘stateful Session’ From ‘entity Bean’?
While each go through activation and passivation; EB have ejbStore () callback to keep country thru passivation and ejbLoad () callback to load nation through activation. But in case of SS, this isn't wished because S.S.B fields are serialized via objects by using packing containers.
Question 17. What Is An Ejb Context?
EJBContext is an interface implemented through the field. It is a part of the bean-container contract.
EntityContext: This is a sub-magnificence of EJBContext that Entity beans use.
SessionContext: Session beans use this subclass.
These EJBContext gadgets provide the bean magnificence with records approximately its:
Client the usage of the bean.
EJB(Enterprise JavaBeans) Interview Questions
Question 18. What Is The Difference Between Ear, Jar And War File?
Modules are packaged based totally on their functionality as EAR, JAR and WAR documents.
JAR documents (.Jar) : Modules which contain EJB magnificence documents and EJB deployment descriptor are packed as JAR documents.
WAR Files (.Battle) : Web modules which comprise Servlet magnificence documents, JSP Files, assisting files, GIF and HTML documents are packaged as JAR file.
EAR Files (.Ear) : ‘.Jar’ & ‘.Battle’ files are packaged as JAR files. ‘Ear’ stands for employer archive. These documents are deployed inside the software server.
J2EE Interview Questions
Question 19. Enlist The Contents Of Container, Container Contains?
Security guide: Used to configure Deployment Descriptor (DD).
Persistence guide: Used to be persistence in transactions.
Transaction management aid: Used to configure Deployment Descriptor (DD).
Management of Session: Callback strategies such as ejbStore (), ejbLoad () are used in the Developer.
Management of Life Cycle: Automatic
EJB(Enterprise JavaBeans) Tutorial
Question 20. What Is Deployment Descriptor?
A deployment descriptor is an XML file packaged with the organization beans in an EJB JAR record or an EAR report. It includes metadata describing the contents and shape of the agency beans, and runtime transaction and protection statistics for the EJB container.
Java applet Interview Questions
Question 21. What Is Ejb Server?
An EJB server is a high-degree procedure or application that provides a run-time environment to assist the execution of server applications that use corporation beans. An EJB server affords a JNDI-available naming carrier, manages and coordinates the allocation of assets to client applications, gives get admission to to gadget resources, and provides a transaction service. An EJB server can be furnished via, as an instance, a database or software server.
Question 22. What Is Ejb Architecture(components)?
Enterprise beans-An company bean is a non-visual thing of a distributed, transaction-orientated enterprise software. Enterprise beans are typically deployed in EJB boxes and run on EJB servers.
There are 3 sorts of organization beans: consultation beans, entity beans, and message-driven beans.
Session beans: Session beans are non-persistent corporation beans. They can be stateful or stateless. A stateful session bean acts on behalf of a unmarried consumer and maintains purchaser-specific consultation records (called conversational country) across a couple of technique calls and transactions. It exists all through a unmarried customer/server consultation. A stateless session bean, by assessment, does no longer keep any conversational nation. Stateless consultation beans are pooled by using their container to address a couple of requests from more than one clients.
Entity beans: Entity beans are corporation beans that comprise persistent records and that may be stored in diverse continual records stores. Each entity bean includes its very own identification. Entity beans that control their very own staying power are called bean-controlled endurance (BMP) entity beans. Entity beans that delegate their persistence to their EJB container are called field-managed patience (CMP) entity beans.
Message-driven beans: Message-pushed beans are organization beans that get hold of and system JMS messages. Unlike session or entity beans, message-driven beans don't have any interfaces. They can be accessed handiest through messaging and that they do no longer preserve any conversational state. Message-driven beans permit asynchronous verbal exchange among the queue and the listener, and provide separation between message processing and enterprise common sense.
Question 23. What Is Ejb Container?
An EJB box is a run-time surroundings that manages one or more company beans. The EJB box manages the existence cycles of company bean objects, coordinates allotted transactions, and implements object security. Generally, each EJB box is provided with the aid of an EJB server and consists of a fixed of organization beans that run on the server.
Java Interview Questions
Question 24. What Is Local Client View?
The neighborhood consumer view specification is most effective to be had in EJB 2.0. Unlike the far off purchaser view, the neighborhood patron view of a bean is place based. Local patron view get admission to to an company bean calls for each the local client and the company bean that offers the neighborhood client view to be in the equal JVM. The local patron view therefore does no longer offer the location transparency provided through the far flung client view. Local interfaces and local home interfaces provide aid for light-weight get right of entry to from employer bean which are local customers. Session and entity beans may be tightly couple with their customers, allowing get entry to without the overhead typically associated with far flung technique calls.
Core Java Interview Questions
Question 25. What Is Remote Client View?
The faraway customer view specification is most effective available in EJB 2.0. The far off client view of an company bean is vicinity unbiased. A customer strolling inside the identical JVM as a bean example makes use of the same API to access the bean as a client jogging in a unique JVM on the identical or different gadget.
Remote interface: The faraway interface specifies the faraway commercial enterprise strategies that a consumer can name on an company bean.
Remote domestic interface: The faraway domestic interface specifies the methods used by far off customers for locating, developing, and getting rid of times of corporation bean instructions.
Java 8 Tutorial
Question 26. What Are The Optional Clauses In Ejb Ql?
WHERE and ORDERBY clauses are non-obligatory in EJB QL wherein as SELECT and FROM are required clauses.
Java 8 Interview Questions
Question 27. Can I Invoke Runtime.Gc() In An Ejb?
You shouldn’t. What will manifest relies upon at the implementation, however the call will most possibly be not noted.
JSP Interview Questions
Question 28. Why Does Ejb Needs Two Interfaces(domestic And Remote Interface)
There is a natural division of roles between the 2. Home Interface is the manner to talk with the box which is responsible for growing , finding and casting off beans and Remote Interface is the hyperlink to the bean that permits acces to all strategies and contributors.
Question 29. Is Decorator An Ejb Design Pattern?
No. Decorator design pattern, is the only which famous very low stage runtime polymorphism, for the unique and unmarried item (Instance of the elegance), but no longer for atleast for a category. It is the stuff to add specific capability to a unmarried & pointed object and leaves others find it irresistible unmodified. It is having close similarities like aspectJ stuff, however now not with EJB stuff.
Java Programmer Interview Questions
Question 30. What Is The Difference Between Sessioncontext And Entitycontext?
Since EnterpriseBeans live in a controlled box, the box is loose to name your EJB components techniques at its entertainment. The box houses the records like contemporary fame of bean,safety credentials of the person presently accessing the bean in one object is referred to as EJBContext Object. A context represents a manner for beans to carry out callbacks and modify their cutting-edge repute Sessioncontext is EJB context for session bean Entitycontext is EJB context for entity bean Message driven context is EJB context for message driven bean
Question 31. Name The Containers Which Uses Border Layout As Their Default Layout?
Containers which makes use of Border Layout as their default are: window, Frame and Dialog classes.
Question 32. What's The Difference Between An Interface And An Abstract Class?
An abstract class can also incorporate code in technique bodies, which isn't allowed in an interface. With summary lessons, you have to inherit your magnificence from it and Java does now not allow more than one inheritance. On the other hand, you can put into effect a couple of interfaces for your magnificence.
Question 33. How Could Java Classes Direct Program Messages To The System Console, But Error Messages, Say To A File?
The elegance System has a variable out that represents the same old output, and the variable err that represents the same old blunders device. By default, they each factor at the system console. This how the standard output might be re-directed:
Stream st = new Stream(new FileOutputStream("output.Txt")); System.SetErr(st); System.SetOut(st);
Java-Springs Interview Questions
Question 34. Can You Have Virtual Functions In Java?
Yes, all features in Java are virtual by means of default. This is truely a pseudo trick query because the word "virtual" is not part of the naming convention in Java (as it's far in C++, C-sharp and VB.NET), so this would be a overseas concept for a person who has most effective coded in Java. Virtual features or virtual techniques are capabilities or techniques to be able to be redefined in derived training.
Question 35. What Is More Advisable To Create A Thread, By Implementing A Runnable Interface Or By Extending Thread Class?
Strategically speakme, threads created by way of implementing Runnable interface are extra beneficial. If you create a thread by means of extending a thread class, you can not make bigger some other magnificence. If you create a thread by means of implementing Runnable interface, you store a space on your class to extend another magnificence now or in future.
Question 36. What Does A Well-written Oo Program Look Like?
A well-written OO software reveals recurring structures that promote abstraction, flexibility, modularity and beauty.
JMS(Java Message Service) Interview Questions
Question 37. What Is Java?
Question 38. What Is The Relationship Between An Event-listener Interface And An Event-adapter Class?
An event-listener interface defines the techniques that need to be implemented via an occasion handler for a specific form of event. An event adapter affords a default implementation of an occasion-listener interface.
Question 39. What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?
During compilation, the values of every case of a switch statement need to compare to a price that can be promoted to an int fee.
Question 40. What Is The Highest-level Event Class Of The Event-delegation Model?
The java.Util.EventObject class is the best-level class within the event-delegation elegance hierarchy.
EJB(Enterprise JavaBeans) Interview Questions
Question 41. How Can A Gui Component Handle Its Own Events?
A factor can manage its personal activities by means of imposing the desired occasion-listener interface and including itself as its own occasion listener.
Question forty two. What Is The Difference Between A While Statement And A Do Statement?
A while statement checks at the start of a loop to look whether or not the subsequent loop new release have to occur. A do statement assessments on the cease of a loop to look whether or not the next new release of a loop need to arise. The do declaration will continually execute the body of a loop as a minimum as soon as.
Java applet Interview Questions
Question forty three. How Are The Elements Of A Gridbaglayout Organized?
The elements of a GridBagLayout are organized in line with a grid. However, the factors are of various sizes and may occupy a couple of row or column of the grid. In addition, the rows and columns might also have unique sizes.
Question 44. What Is The Difference Between A Choice And A List?
A Choice is displayed in a compact form that calls for you to pull it right down to see the listing of to be had selections. Only one object may be decided on from a Choice. A List may be displayed in the sort of way that several List gadgets are seen. A List supports the choice of one or extra List items.
Question 45. How Are This () And Super () Used With Constructors?
This() is used to invoke a constructor of the equal magnificence. Great() is used to invoke a superclass constructor.
Question 46. Under What Conditions Is An Object's Finalize() Method Invoked By The Garbage Collector?
The garbage collector invokes an object's finalize() approach whilst it detects that the item has become unreachable.
Question forty seven. What Is The Difference Between A Field Variable And A Local Variable?
A subject variable is a variable that is declared as a member of a category. A local variable is a variable that is declared local to a method.
Question 48. What Class Allows You To Read Objects Directly From A Stream?
The ObjectInputStream elegance supports the studying of objects from input streams.
Question forty nine. What Class Of Exceptions Are Generated By The Java Run-time System?
The Java runtime device generates RuntimeException and Error exceptions.
Question 50. What Is The Relationship Between A Method's Throws Clause And The Exceptions That Can Be Thrown During The Method's Execution?
A technique's throws clause must declare any checked exceptions that aren't caught in the frame of the method.
Question fifty one. What Is The Difference Between The Jdk 1.02 Event Model And The Event-delegation Model Introduced With Jdk 1.1?
The JDK 1.02 event version makes use of an event inheritance or bubbling method. In this model, additives are required to deal with their very own occasions. If they do not take care of a specific occasion, the event is inherited by (or bubbled up to) the issue's box. The field then either handles the occasion or it's miles bubbled as much as its container and so forth, till the highest-degree container has been tried. In the event-delegation version, unique items are detailed as event handlers for GUI components. These objects implement event-listener interfaces. The occasion-delegation model is greater efficient than the occasion-inheritance version because it gets rid of the processing required to support the effervescent of unhandled occasions.
Question 52. How Is It Possible For Two String Objects With Identical Values Not To Be Equal Under The == Operator?
The == operator compares gadgets to decide if they may be the same object in memory. It is possible for 2 String items to have the identical price, but located detached areas of memory.
Question 53. Why Are The Methods Of The Math Class Static?
So they may be invoked as though they're a mathematical code library.
Question fifty four. What Are The Legal Operands Of The Instanceof Operator?
The left operand is an item reference or null value and the proper operand is a category, interface, or array kind.
Question 55. How Are The Elements Of A Gridlayout Organized?
The factors of a GridBad layout are of same length and are laid out the use of the squares of a grid.
Question fifty six. What An I/o Filter?
An I/O filter out is an object that reads from one circulate and writes to some other, commonly altering the information in some manner as it's far handed from one move to every other.
Question 57. If An Object Is Garbage Collected, Can It Become Reachable Again?
Once an object is garbage gathered, it ceases to exist. It can no longer emerge as available again.
Question fifty eight. What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?
Java makes use of layout managers to lay out additives in a steady manner throughout all windowing structures. Since Java's layout managers aren't tied to absolute sizing and positioning, they're able to accommodate platform-specific variations among windowing systems.
Question fifty nine. What Is The Collection Interface?
The Collection interface provides help for the implementation of a mathematical bag - an unordered series of items that could include duplicates.
Question 60. What Modifiers Can Be Used With A Local Inner Class?
A nearby internal elegance may be very last or summary.
Question sixty one. What Is The Difference Between Static And Non-static Variables?
A static variable is related to the magnificence as a whole in preference to with precise instances of a category. Non-static variables take on precise values with each object example.
Question sixty two. What Is The Difference Between The Paint() And Repaint() Methods?
The paint() method helps portray thru a Graphics item. The repaint() method is used to purpose paint() to be invoked by way of the AWT painting thread.
Question sixty three. What Is The Purpose Of The File Class?
The File magnificence is used to create gadgets that offer access to the documents and directories of a neighborhood document system.
Question 64. Which Math Method Is Used To Calculate The Absolute Value Of A Number?
The abs() approach is used to calculate absolute values.
Question sixty five. How Does Multithreading Take Place On A Computer With A Single Cpu?
The running machine's task scheduler allocates execution time to a couple of duties. By quick switching among executing tasks, it creates the affect that duties execute sequentially.
Question 66. When Does The Compiler Supply A Default Constructor For A Class?
The compiler components a default constructor for a category if no other constructors are furnished.
Question sixty seven. When Is The Finally Clause Of A Try-capture-subsequently Statement Executed?
The ultimately clause of the attempt-trap-eventually announcement is constantly accomplished until the thread of execution terminates or an exception takes place in the execution of the sooner or later clause.
Question sixty eight. If A Method Is Declared As Protected, Where May The Method Be Accessed?
A covered approach can also handiest be accessed via lessons or interfaces of the equal bundle or with the aid of subclasses of the elegance wherein it's miles declared.
Question 69. How Can The Checkbox Class Be Used To Create A Radio Button?
By associating Checkbox items with a CheckboxGroup.
Question 70. Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?
The non-Unicode letter characters $ and _ may additionally appear as the first individual of an identifier
Question seventy one. What Happens When You Invoke A Thread's Interrupt Method While It Is Sleeping Or Waiting?
When a assignment's interrupt() method is accomplished, the task enters the prepared country. The subsequent time the venture enters the going for walks country, an InterruptedException is thrown.