Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

bean's lifecycle callback method

 
vitesse wei
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,This is another mock question about Bean's lifecycle callback method annotation,I think there is no correct answer,but given answer is C,anyoen agree with me?

Which is a valid Post Construct method in a message-driven bean class?
A. @PostConstruct
public boolean init() { return true; }
B. @PostConstruct
private static void init() {}
C. @PostConstruct
private void init() {}
D. @PostConstruct
public static void init() {}
 
Adam Tkaczyk
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer C is ok.
Here http://java.sun.com/javaee/5/docs/api/javax/annotation/PostConstruct.html
is explanation why.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!