scala的trait执行报错: 错误: 找不到或无法加载主类 cn.itcast.scala.`trait`
Posted mediocreworld
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scala的trait执行报错: 错误: 找不到或无法加载主类 cn.itcast.scala.`trait`相关的知识,希望对你有一定的参考价值。
scala的trait执行报错:
错误: 找不到或无法加载主类 cn.itcast.scala.`trait`.Children
原因:包名写成了trait,与trait关键字重名了:
package cn.itcast.scala.`trait`
解决方法:将包名trait修改为其他名字,比如traits
以上是关于scala的trait执行报错: 错误: 找不到或无法加载主类 cn.itcast.scala.`trait`的主要内容,如果未能解决你的问题,请参考以下文章
Product.scala trait 中 productPrefix def 的实际使用