Join Slack
Powered by
What is the difference between `anInstance.javaCla...
# getting-started
j
Jonathan Olsson
11/02/2022, 12:23 PM
What is the difference between
anInstance.javaClass
and
anInstance::class.java
?
s
Sam
11/02/2022, 12:46 PM
Not much. I think this SO post covers the key points:
https://stackoverflow.com/questions/46674787/instanceclass-java-vs-instance-javaclass
🙏 1
j
Jonathan Olsson
11/02/2022, 12:52 PM
I take it then that ::class.java is preferred over javaClass?
s
Sam
11/02/2022, 12:53 PM
I would say yes 👍 the return type is more correct and the meaning is less likely to be ambiguous or unexpected
9
Views
Open in Slack
Previous
Next