Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the reason for using "Kt" suffix in Kotlin classes?

Tags:

kotlin

I was trying to find more details about this decision in the Kotlin documentation but there is no section that "talks" about it. Does anyone know what drove the decision to use the "Kt" suffix in class names in Kotlin? Is it to avoid collision with Java class names, or is there more to it?

like image 274
DejanLekic Avatar asked Aug 04 '17 11:08

DejanLekic


1 Answers

Unlike Java, Kotlin allows you to define functions that are not inside a class. But if you want Java to talk to Kotlin that becomes a problem. How to solve it? Convert those functions into static methods of a class named as the file with the "Kt" suffix

You can find more info about that in the documentation

like image 83
Alberto S. Avatar answered Nov 11 '22 11:11

Alberto S.