07-20-2023, 09:26 AM
Let's say I declared a final field with `private final String s` (Java) or `val s` (Kotlin). During initialization I want to initialize the field with the result of a call to a remote service. In Java I would be able to initialize it in the constructor (e.g. `s = RemoteService.result()`), but in Kotlin I can't figure out how to do that because as far as I can tell the field has to be initialized in the same line it's declared. What's the solution here?