2022年6月6日星期一

why do we sometimes add a question mark to "String" when declaring a variable?

 variable_type ? name_of_variable; means that name_of_variable can be null.

 

variable_type  name_of_variable1; means that name_of_variable1 cannot be null and you should initialize it immediately.

 

late variable_type  name_of_variable2; means that name_of_variable2 cannot be null and you can initialize it later.


沒有留言:

發佈留言