当前位置:网站首页>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 对等
边栏推荐
猜你喜欢
随机推荐
使用mysq语句操作数据库
数字藏品平台系统开发实战
“蔚来杯“2022牛客暑期多校训练营7
Analysys and the Alliance of Small and Medium Banks jointly released the Hainan Digital Economy Index, so stay tuned!
LeetCode_2598_剑指Offer Ⅱ 091.粉刷房子
Custom picker scroll selector style
SWIG教程《一》
Boss raises salary!Look at my WPF Loading!!!
How to code like a pro in 2022 and avoid If-Else
Pytest framework optimization
微信扫码登陆(1)—扫码登录流程讲解、获取授权登陆二维码
Based on Azuki Series: NFT Valuation Analysis Framework "DRIC"
SWIG tutorial "four" - package of go language
宝塔面板开放Redis给指定外网机器
机器学习总结(一)
电脑重装系统提示activex部件不能创建对象如何解决
从全球价值链视角看,京东云数智供应链对未来经济有何影响?
字节终面:CPU 是如何读写内存的?
E. Cross Swapping (and check out deformation/good questions)
快速了解大端模式和小端模式









