• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

HF-EJB: Uncaught Error?

 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
It runs on an internal combustion engine. This ad does not:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic