Non-nullable type
A non-nullable type is a type whose values are statically constrained not to include the null value.
Kotlin in Action, 2E
A non-nullable type is a Kotlin type whose values are not permitted to be null by the type system.
- How it is used
- Establishes compile-time boundaries between required values and values that may be absent.
- How deep it goes
- Explains declarations, smart casts, subtyping, generics, delayed properties, and Java overrides without detailing generated checks further.
- Examples
- Uses string-length functions, email sending, generic processors, Java interface overrides, and JUnit-style service setup.
- What you can do after
- Apply it by declaring required values non-nullable and converting nullable values only after an explicit safe path.
Pro ASP.NET Core 7, Tenth Edition
A non-nullable variable is a variable whose type does not permit the special null value.
- How it is used
- Prevents null reference mistakes by making permitted null states explicit and turning violations into compiler warnings.
- How deep it goes
- Explains declarations, required initialization, defaults, and array nullability, including how element and container annotations differ.
- Examples
- Uses Product.Name, Product arrays, Kayak and Lifejacket objects, null elements, required initializers, and string.Empty defaults.
- What you can do after
- Apply nullable annotations, required members, and defaults to make C# object and collection null behavior compile-time explicit.
Read how Pro ASP.NET Core 7, Tenth Edition explains non-nullable type →
Related concepts
- nullable typecontrasts with · A nullable type is a type whose values may be either a value of the underlying type or an explicit representation of absence, such as null.
- !! operatorproduced by · The !! operator is Kotlin's non-null assertion operator, which treats a nullable expression as non-null and throws an exception if it is null.
- missing valuecontrasts with · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
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.

