Course:: The Quiz Questions
Course:: The Quiz Questions
StopWatch sw = new
StopWatch();
Constructor is a method.
The constructor is obliged to set the values of ALL the data members.
You can distinguish between the data member and the parameter with
the same name.
If you refer to a data member you always have to use this reference.
It can be accessed from the same class, from a subclass and from
the same package.
You can access the members designated with this modifier from
classes in the same package.
It is a class.
The answers
X Constructor is a method.
X The name of the constructor equals to the name of the class.
The constructor is obliged to set the values of ALL the data members.
private Designates the members that are accessible only from inside
the class.
public You can access these members from all the classes.
private Rule of thumb: you use it for data members – by default.
protected It can be accessed from the same class, from a subclass and from
the same package.
package You can access the members designated with this modifier from
private classes in the same package.
package This is the name if you do not specify anything.
private
X It is a class.