如何将 Java 源文件的一部分转换为 Kotlin? [英] How can I convert a part of Java source file to Kotlin?

查看:24
本文介绍了如何将 Java 源文件的一部分转换为 Kotlin?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Kotlin 项目中,我想将 Java 代码的某些部分转换为 Kotlin.将 Java 文件转换为 Kotlin 的菜单项被禁用,因为它不是我想要转换的整个文件.

In my Kotlin project, I have some parts of Java code that I want to convert to Kotlin. The menu item that converts the Java file to Kotlin is disabled because it's not a whole file I want to convert.

如何将 Java 代码转换为 Kotlin?

How can I convert Java code to Kotlin?

推荐答案

没有将 Kotlin 代码转换为 Java 的工具.如果要将文件的一部分从 Java 转换为 Kotlin,最简单的方法是从 IDE 中的 Java 文件中复制代码并将其粘贴到 Kotlin 文件中.

There is no tool to convert Kotlin code to Java. If you want to convert part of a file from Java to Kotlin, the easiest way is to copy the code from the Java file in the IDE and paste it into the Kotlin file.

这篇关于如何将 Java 源文件的一部分转换为 Kotlin?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆