posted 16 years ago
Folks
Below is a question and the explanation for the correct answers, from ejbcertificate.com. My confusion is on 5. Why is 5 not right? HFEJB suggesets to leave out the constructor as the compiler will insert the default constructor and hence 5 should be correct. Please suggest.
TIA
Vijay
==========================================================================
Which of the following statements are requirements for the session bean class?
1) The session bean class must implement, directly or indirectly the javax.ejb.SessionBean interface. 2) Each method defined in the session bean class must have a matching method in the session bean's remote interface. 3)The class must be defined as public. 4) The class can be declared final. 5) A stateful session bean class does not have to define a no-argument public constructor.
Answers 1 and 3 are correct.
Answer 2 is incorrect. The session bean class can define other methods such as helper methods for internal uses that are not made available to remote clients. However, each method defined in a session bean's remote interface must be defined in the session bean class.
Answer 3 is incorrect. If the session bean class is declared final, the container will be unable to extend the class should it wish to mix in some container-specific code with the session bean class.
Answer 5 is incorrect because the container uses the no-argument constructor to create instances of the session bean class
==========================================================================