1、基本语法
o 区分大小写
o 类名:首字母要大写,如 class HelloWorld{},class
Person{},class Student{},也称大驼峰
o 方法名称:首字母小写,从第 2 个单词开启的首字段大写,如
def toString(),def getName(),即为小驼峰
o 程序文件名:保持与类名或对象名一致,区分大小写,以
".scala"来结尾。
o 主程序入口:def main(args: Array[String]) ,scala 若要独立运行
必须从 main 方法开始处理,每个 scala 强制程序入口。
2、关键字
o 以下为保留关键字,不要以关键字作为变量命名。
abstract case catch class
def do else extends
false final finally for
forSome if implicit import
lazy match new null
object override package private
protected return sealed super
this throw trait trytrue type val var while with yield - : = => <- <: <% >: # @