当前位置:网站首页>scala basics
scala basics
2022-08-10 15:21: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 To run independently
必须从 main 方法开始处理,每个 scala 强制程序入口.
2、关键字
o The following are reserved keywords,Do not use keywords as variable names.
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 对等
边栏推荐
猜你喜欢

Analysys and the Alliance of Small and Medium Banks jointly released the Hainan Digital Economy Index, so stay tuned!

易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!

中学数学建模书籍及相关的视频等(2022.08.09)

SWIG tutorial "two"

Appium进行APP自动化测试

E. Cross Swapping(并查集变形/好题)

基于 Azuki 系列:NFT估值分析框架“DRIC”

【语义分割】DeepLab系列

QOS function introduction

蓝帽杯半决赛火炬木wp
随机推荐
"Thesis Reading" PLATO: Pre-trained Dialogue Generation Model with Discrete Latent Variable
兆骑科创创业赛事活动发布平台,创业赛事,项目路演
Zhaoqi Technology Innovation High-level Talent Entrepreneurship Competition Platform
机器学习总结(一)
640. 求解方程 : 简单模拟题
Unfinished mathematics test paper ----- test paper generator (Qt includes source code)
强意识 压责任 安全培训筑牢生产屏障
Introduction to the Internet (2)
SWIG教程《二》
小程序-语音播报功能
Problem solving-->Online OJ (19)
APP automation testing with Uiautomator2
Steam教育在新时代中综合学习论
《论文阅读》PLATO: Pre-trained Dialogue Generation Model with Discrete Latent Variable
【语义分割】DeepLab系列
Go Context基本使用
MySQL 原理与优化:Update 优化
容器化 | 在 S3 实现定时备份
【MindSpore易点通机器人-02】设计与技术选型
“国资云”和“国家云”能给市场带来怎样的变革?