当前位置:网站首页>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 对等
边栏推荐
- 快速了解大端模式和小端模式
- sql语句 异常 Err] 1064 – You have an error in your SQL syntax; check the manual that corresponds to your
- $'\r': command not found
- List集合
- SWIG Tutorial "One"
- MQTT服务器搭建
- antd组件中a-modal设置固定高度,内容滚动显示
- pm2 static file service
- DB2查询2个时间段之间的所有月份,DB2查询2个时间段之间的所有日期
- Meaning and names of 12 nautical miles, 24 nautical miles and 200 nautical miles
猜你喜欢
SWIG Tutorial "One"
中学数学建模书籍及相关的视频等(2022.08.09)
It is reported that the original Meitu executive joined Weilai mobile phone, the top product may exceed 7,000 yuan
Classifying irises using decision trees
消息称原美图高管加盟蔚来手机 顶配产品或超7000元
基于ArcGIS水文分析、HEC-RAS模拟技术在洪水危险性及风险评估
Unfinished mathematics test paper ----- test paper generator (Qt includes source code)
BCG库简介
等保2.0一个中心三重防护指的是什么?如何理解?
数学建模学习视频及资料集(2022.08.10)
随机推荐
Websocket realizes real-time change of chart content
富爸爸穷爸爸之读书笔记
QOS功能介绍
[Semantic Segmentation] DeepLab Series
数字藏品平台系统开发实战
基于ArcGIS水文分析、HEC-RAS模拟技术在洪水危险性及风险评估
微信小程序,自定义输入框与导航胶囊对其
第五讲 测试技术与用例设计
systemui屏蔽通知栏
【MindSpore易点通机器人-02】设计与技术选型
PEST 分析法
阿里五位MySQL封神大佬耗17个月总结出53章性能优化法则
MySQL Principle and Optimization: Update Optimization
Mini Program-Voice broadcast function
MQTT服务器搭建
统信 UOS V20 专业版(1050update2)发布:文件共享、全局搜索等优化
格式化输出当前时间
640. Solving Equations: Simple Simulation Problems
antd组件中a-modal设置固定高度,内容滚动显示
丁香园