Java: Is there a difference between L and l (lowercase L) when specifying a long?

No practical difference. Either L or l can be used, both indicate a long primitive. Also, either can be autoboxed to the corresponding Long wrapper type.

However, it is worth noting that JLS-3.10.1 – Integer Literals says (in part)

An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (ยง4.2.1).

The suffix L is preferred, because the letter l (ell) is often hard to distinguish from the digit 1 (one).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)