1. HelloWorld // 定义伴生对象 object HelloWorld { def main(args: Array[String]): Unit = { println("HelloWorld") } } // 伴生类 class HelloWorld