我尝试将一些 Scala 源代码转换为 Java 源代码。但我面临一些麻烦。以下是 Scala 源代码。
trait Reader {
def read(name: String): String = {
//some codes are here.....
}
}
trait FileInputBase {
def getFormat(path: String): String = {
//some codes are here.....
}
}
case class FileStreamInput(name: String, path: String) extends Reader with FileInputBase {
def read(name: String): String = {
//some codes are here.....
}
var format = getFormat("joseph")
}
我将这些 Scala 代码转换为 Java 源代码,如下所示,
class Reader {
public String read(String name) {
// some java codes are here
}
}
interface FileInputBase {
public String getFormat(String path) {
// some java codes are here
}
}
我做了java类
public class FileStreamInput extends Reader implements FileInputBase {
....
}
但这些Java代码根本不起作用。我是 Scala 语言的初学者。
翻阅古今
相关分类