So how to assign the null value to our variable of name so for that in kotlin we have something called nullable datatype to do that we have to make this string as nullable by using the question mark here so this rectify is our error now similar to string you can create an allowable integer or a nullable float value similarly nullable boolean value and0 even the custom classes such as student or employee so right now I will use the nullable string value now let us try to explode our null safety operators so here these are the comment statements where we will explore all the full types of null safety operators There are four types of null safety operators. In kotlin by default the null value is not supported to avoids the null pointer exception we have a lot of null safety operators which helps to avoid the null pointer exception and makes our application more robust and errors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |