August 2018
Intermediate to advanced
524 pages
14h 45m
English
We have already looked at the code for the class code and it was the simplest class in the world. In reality, as it is in the Packt code repository, the code is a bit more complex:
/**
* Represents a color in the MasterMind table.
*/
public class Color {
/**
* A special object that represents a
* value that is not a valid color.
*/
public static final Color none = new Color();
}
We have a special color constant named none that we use to signal a reference that is of type Color but is not a valid Color. In professional development, we used the null value for a long time to signal invalid reference, and because we are backwards compatible, we still use it. However, it is recommended to avoid the null reference wherever possible. ...
Read now
Unlock full access