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 →
Also covered in
What to know first
- attributeAn attribute is a named property or piece of information associated with an entity, object, or structured data item.
- missing valueA missing value is an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
- nullable annotationA nullable annotation is metadata attached to a type or declaration indicating whether a value, parameter, field, or result may be null.
- optionAn option type is a type that represents either a value of a specified type or its absence as distinct alternatives.
Related concepts
- optioncontrasts with · An option type is a type that represents either a value of a specified type or its absence as distinct alternatives.
- !! 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 an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
Questions about non-nullable type
What is non-nullable type?
A non-nullable type is a type whose values are statically constrained not to include the null value.
Which Manning books explain non-nullable type?
Kotlin in Action, 2E and Pro ASP.NET Core 7, Tenth Edition.
What should I know before learning non-nullable type?
Manning books that teach non-nullable type usually introduce attribute, missing value, nullable annotation and option first.
What is the difference between non-nullable type and option?
A non-nullable type is a type whose values are statically constrained not to include the null value. An option type is a type that represents either a value of a specified type or its absence as distinct alternatives.
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.

