liveBook · Manning

Long literal

A Long literal is a numeric literal whose syntax specifies that its value has the Kotlin Long integer type.

How 2 Manning books explain it

100 Java Mistakes and How to Avoid Them

How it is used
Prevents `int` arithmetic, shifts, and hexadecimal masks from producing incorrect values when long-width results are intended.
How deep it goes
Explains expression typing, shift behavior, signed widening, overflow consequences, tests, API alternatives, and selected static-analysis checks.
Examples
Uses microsecond conversion, a long bit-setting method, and a hexadecimal mask that accidentally widens from `int` to `long`.
What you can do after
Diagnose/debug with it by identifying `int` operands in long computations and correcting literals, casts, tests, or API usage.

Read how 100 Java Mistakes and How to Avoid Them explains Long literal →

Learn C++ by Example

A literal suffix is a token appended to a literal to determine or customize the type or interpretation of its value.

How it is used
Makes chrono durations and calendar dates readable in countdown and date-handling code.
How deep it goes
Explains suffix syntax, supported units, namespaces, and operator implementation without developing custom literal definitions.
Examples
Uses duration forms such as 23h and date forms such as 2022y / December / 31.
What you can do after
Apply it via chrono literal suffixes to write strongly typed durations and readable calendar dates.

Read how Learn C++ by Example explains Long literal →

What to know first

Related concepts

Questions about Long literal

What is Long literal?

A Long literal is a numeric literal whose syntax specifies that its value has the Kotlin Long integer type.

Which Manning books explain Long literal?

100 Java Mistakes and How to Avoid Them and Learn C++ by Example.

What should I know before learning Long literal?

Manning books that teach Long literal usually introduce long first.

What is Long literal a kind of?

Long literal is a kind of literal. A literal is a language construct that directly denotes a fixed value or specifies an exact value permitted by a type.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.