August 2004
Intermediate to advanced
480 pages
9h 41m
English
Java programmers commonly define constants inside their interfaces, if it makes design sense. You can do so using variables in an interface because the values will be present instantly at runtime and their values shared among all classes implementing your interface, because they are static and final.
Here is how you do it.
public interface IDataAccessor {
String DB_NAME = "Squishy";
}
|
Read now
Unlock full access