Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF-EJB: Uncaught Error?

 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's with the newInstance() on pages 463, question 3 and its corresponding answer on page 466? Do they mean a call to a constructor? It is not in the errata so maybe I misunderstood something?

Anybody has the answer?

Thanks!
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tony Alicea:
What's with the newInstance() on pages 463, question 3 and its corresponding answer on page 466? Do they mean a call to a constructor? It is not in the errata so maybe I misunderstood something?

Anybody has the answer?

Thanks!


Yes, they do. Because classes are created using DD info, each class object has got a newInstance() method which invokes the default, no-arg constructor.

Here follows the signature (from J2SE API):

 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, Marco.

Researching your answer, I see that the process to invoke the default constructor would be (?)

MyBeanClass.getClass().newInstance()

which is different from

MyBeanClass.newInstance() which is what the example in the book suggests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic