当前位置:网站首页>scala 基础篇
scala 基础篇
2022-08-10 14:46:00 【S_ng】
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 - : = => <- <: <% >: # @
3、数据类型
与 Java 相似部分(皆为对象类型,scala 无原生数据类型)Byte,Short,Int,Long,Float,Double,Char,String,Boolean
4、运算符
无自增自减,其余和java相同。
5、循环
String 类。
完全与 java.lang.String 对等
边栏推荐
猜你喜欢
Flask框架——基于Celery的后台任务
win2012安装Oraclerac失败
QOS function introduction
机器学习总结(一)
MySQL 原理与优化:Update 优化
[Semantic Segmentation] DeepLab Series
Unfinished mathematics test paper ----- test paper generator (Qt includes source code)
E. Cross Swapping (and check out deformation/good questions)
解题-->在线OJ(十九)
池化技术有多牛?来,告诉你阿里的Druid为啥如此牛逼!
随机推荐
MySQL - storage engine for databases
Based on Azuki Series: NFT Valuation Analysis Framework "DRIC"
Boss raises salary!Look at my WPF Loading!!!
Second half of 2011 System Architect Afternoon Paper II
解读STEAM教育中的表现性评价
【MindSpore易点通机器人-02】设计与技术选型
消息称原美图高管加盟蔚来手机 顶配产品或超7000元
2022-08-10日报: Swin Transformer作者曹越加入智源,开展视觉基础模型研究
antd组件中a-modal设置固定高度,内容滚动显示
舵机内部结及工作原理浅析[通俗易懂]
静态变量存储在哪个区
Zijin Example
BCG库简介
紫金示例
Appium for APP automation testing
面试面到了一个腾讯30k出来的,有见识到何为精通MySQL调优
容器化 | 在 S3 实现定时备份
Summary of Force Buckle Solution 640 - Solving Equations
TestLink导出用例转换工具
使用mysq语句操作数据库