Avatar ·

How to call Kotlin extension functions from Java and why are they not visible?

Hello everyone! I'm new to Kotlin, transitioning from Java. I wrote a couple of extension functions for the String class in a separate file Utils.kt: ```kotlin // Utils.kt package com.example.utils fun String.isEmail(): Boolean = this.contains("@") fun String.capitalizeWords(): String = this.split(" ").joinToString(" ") { it.capitalize() } ``` In Kotlin everything works fine, but when I try to call these functions from Java code, the IDE highlights them in red: ```java // Main.java import com.example.utils.UtilsKt; // import appeared, but... public class Main { public static void main(String[] args) { String email = "test@example.com"; // Error: Cannot resolve method 'isEmail' System.out.println(email.isEmail()); // And this also doesn't work: ```