Avatar ·

What does the exclamation mark mean in Kotlin and how to get rid of it?

Hi everyone! I just started learning Kotlin after Java and encountered an unclear construct. In someone else's code, I saw that there is one exclamation mark after the variable type, for example: ```kotlin val name: String! = someJavaMethod() ``` I tried to understand what it means, but I couldn't find anything in the documentation. When I write such code in my own project, the compiler gives an error "This type has a constructor". And if I use it in a function return type, IDEA underlines it in red. At the same time, in logs I see that sometimes the variable can be null, and sometimes not. I tried writing `String?` — then the compiler complains that I supposedly cannot "unpack". And if `String` — it gives a warning about a possible NPE. Please tell me: 1. What is `String!` and why