Given:
and
What is the result?
Given:
and
What is the result?
The code will fail to compile due to an error in line 1. In the Person class, a parameterized constructor is explicitly defined. Therefore, the default no-argument constructor is not implicitly created. When attempting to create a new instance of Person using the no-argument constructor (new Person()), the compiler will throw an error because the no-argument constructor does not exist.
tested
Contructor withot parameter no exist
Remember : if you create a explicit constructor with parameters, musth be create too the constructor without parameter if you want to use it. Because Java no create default constructor with no parameter when other constructor exist