Hello. I am studying for SCWCD exam and in one of the questions I found, said that a JavaBean will generate a compile time error just because it does not have non-arg constructor. Explicitly the author of the exam says:
"Since MyBean does not have a no-arg constructor, the container cannot instantiate it and hence a Compilation error
MyBean is the class with a no arg-constructor. I think this is wrong, because it would generate a run-time error, when the container tries to instantiate the bean. Am I wrong?
The exam i am talking about is Practice Test I, question number 19 from whizlabs.
I think you are rigth.
the compile tries to find out the non-arg constructor because it is in the specification.
How would you do to instantiate the Bean using <jsp:useBean> tag for example, without non-arg constructor?