package test39 //泛型特质object test5 { //定义一个日志//泛型特质.X是泛型名称,可以更=更改trait Logger[X]{val content:Xdef show():Unit }//定义一个类去实现特质class FileLogger extends Logger[String]{override val content: String = "file"override def show(): Unit = {println(content)}}def main(args: Array[String]): Unit = {val fileLogger = new FileLogger()fileLogger.show()} }