Suppose for a class ABC, what does fun ABC () mean...
# announcements
f
Suppose for a class ABC, what does fun ABC () mean? Constructor are defined in a different way in kotlin
a
feroz_baig: it means an instance method named exactly like the class
if you execute
ABC().ABC()
first you are calling the constructor and then the instance method on the newly created object
f
@agomez Should it be semantically correct. What If this fun is to be accessed via java code?
a
in kotlin is correct, and i supposed from java will be valid to invoke
new ABC().ABC()
👍 1
r
It will be a function, kolitn have their own primary constructor and secondary constructor