If you look into the java doc of Calendar
class, it clearly mentions what is the purpose of cal.DAY_OF_WEEK
. It just represents the number of a field and the get()
method accept the field number and returns its value. You can consider the value of cal.DAY_OF_WEEK
as an index of an array from which the get()
method retrieves the value. Please see below the documentation of get()
method.
Returns the value of the given calendar field. In lenient mode,
* all calendar fields are normalized. In non-lenient mode, all
* calendar fields are validated and this method throws an
* exception if any calendar fields have out-of-range values. The
* normalization and validation are handled by the
* {@link #complete()} method, which process is calendar