We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
尽量不用java调用Kotlin
Sorry, something went wrong.
1: Kotlin 默认是非null 类型,java 返回 null,kotlin 需要添加? 表示可为null 2: kotlin 使用!! 时,要确认变量不为null, 不然会直接抛异常
说一个最大的坑,kotlin调用Java的方法或者属性,不能推断出是否为空,除非加上空或者非空注解。
kotlin调用java的时候 如果java返回值可能为null 那就必须加上@nullable 否则kotlin无法识别,也就不会强制你做非空处理,一旦java返回了null 那么必定会出现null指针异常,加上@nullable注解之后kotlin就能识别到java方法可能会返回null,编译器就能会知道,并且强制你做非null处理,这也就是kotlin的空安全
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: