In HF on page 350,it says bean should have public no arg constructor.We don't have to write one explicitly right? I mean if we don't provide one,by default public no arg constructor is included by JVM right?
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
U can either provide one or leave it to the compiler to produce the default no arg constructor. But incase u have written a constructor which takes one argument then u have to write code to implement ur no arg constructor as well.Hope i am clear.
We don't have to write one explicitly right? I mean if we don't provide one,by default public no arg constructor is included by JVM right?
This is similar to every other class in Java. There would always be a default constructor with no arguments, unless you write one which takes any arguments. When we provide a constructor with arguments, there would not be any no-arg default constructor. The Bean Law says that it should have a no-arg constructor for it to work. So if you write any constructor with arguments, you need to provide a no-arg constructor also. I don't think your arg constructor will ever be called even if you provided one.