Explicit and implicit
In short: Explicit means stated expressly, implicit means silently added by the system. The contrast shows up in type conversions, constructors, imports and interfaces.
In more detail: With explicit code you write down what should happen and the reader sees it. Implicit lets the language take work off your hands but can create surprises.
In detail
- Type conversion: implicit (automatic):
double d = 5;(int becomes double). Explicit (cast):int i = (int) 5.7;(gives 5, the decimals are lost). - Constructor: if a class has none, Java creates an implicit default constructor.
- Type inference:
var x = 5;is an implicit type,int x = 5;an explicit one. - JavaScript: implicit conversion (
"5" * 2is 10,"5" + 2is"52") is a source of bugs, so prefer===and explicit conversion. - Rule: where data loss threatens, the language usually demands an explicit cast.
See also: Constants, Char (character)