1.try表达式
- 定义
try{}catch{}finally{}//例子try{Integer.parseInt("dog")}catch {case _ => 0}finally {println("always be printed")}
2.match表达式
exp match{case p1 =>val1case p2 =>val2...case _ => valm}val code=1code match{case 1 =>"one"case 2 =>"two"case _ =>"other"}