摘要: 1、匹配对象 1 object Test4_MatchObject { 2 def main(args: Array[String]): Unit = { 3 val student = new Student("wl", 22) 4 5 //针对对象实例的内容进行匹配 6 val result = 阅读全文
posted @ 2022-05-24 20:59 小王同学学编程 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 1 object Test2_MatchTypes { 2 def main(args: Array[String]): Unit = { 3 //1、匹配常量 4 def describeConst(x: Any): String = x match { 5 case 1 => "Num one" 阅读全文
posted @ 2022-05-24 20:10 小王同学学编程 阅读(23) 评论(0) 推荐(0) 编辑
levels of contents