I'm confused about the actual visibility of default constructors. I have been given the following code in a book that explains there is a default constructor created, but does not physically show one (i.e. Employee()), despite it being automatically assigned:
public class Employee {
private String name;
private int zip;
private int age;
}
In another book I am told this the following is a default constructor as it takes no arguments:
public class Pet {
private String name;
private int weight;
Pet(){}
}
Is this latter constructor actually default if I'm physically defining it? Or is the default constructor invisible to my code as in the first example because of something relating to the superclass?
Edit: I'm asking about the physical code that is written into a class. One source is telling me that the default constructor is explicitly written out, the other telling me that it will not appear in the code and is essentially assumed to exist though it is not apparent to the user. My issue comes that the explicit one is coming from a java cert study guide so it's causing some confusion for me.