当前位置:网站首页>Scala基础【入门及安装】
Scala基础【入门及安装】
2022-06-30 01:38:00 【hike76】
一 Scala入门
1 什么是Scala
从英文的角度来讲,Scala并不是一个单词,而是Scalable Language两个单词的缩写,表示可伸缩语言的意思。从计算机的角度来讲,Scala是一门完整的软件编程语言,那么连在一起就表示Scala是一门可伸缩的软件编程语言。之所以说它是可伸缩,是因为这门语言体现了面向对象,函数式编程等多种不同的语言范式,且融合了不同语言新的特性。
Scala编程语言是由联邦理工学院洛桑(EPFL)的Martin Odersky于2001年基于Funnel的工作开始设计并开发的。由于Martin Odersky之前的工作是开发通用Java和Javac(Sun公司的Java编译器),所以基于Java平台的Scala语言于2003年底/2004年初发布。
Scala官网:https://www.scala-lang.org/
目前大数据主要的批处理计算引擎框架Spark是基于Scala语言开发的,主要的流式计算引擎框架Flink也提供了Scala相应的API, 并且大数据领域中函数式编程的开发效率更高,更直观,更容易理解。
Martin Odersky是狂热的编译器爱好者,长时间的编程后,希望开发一种语言,能够让写程序的过程变得简单,高效,所以当接触到Java语言后,感受到了这门语言的魅力,决定将函数式编程语言的特性融合到Java语言中,由此产生了2门语言(Pizza & Scala),这两种语言极大地推动了Java语言的发展
- JDK1.5的泛型,增强for循环,自动类型转换等都是从Pizza语言引入的新特性
- JDK1.8的类型推断,λ(lambda)表达式是从Scala语言引入的新特性
由上可知,Scala语言是基于Java开发的,所以其编译后的文件也是字节码文件,并可以运行在JVM中。
2 scala安装
(1)环境安装
安装JDK1.8
解压文件:scala-2.12.11.zip,解压目录要求无中文无空格
配置环境变量



在windows下运行cmd,输入以下命令,出现下图信息表示安装成功。
(2)Scala插件安装
默认情况下IDEA不支持Scala的开发,需要安装Scala插件。
File-Settings-搜索Scala-点击右侧按钮(install)
如果下载慢,请访问网址:https://plugins.jetbrains.com/plugin/1347-scala/versions
(3)hello scala
① 创建maven项目
② 增加Scala框架支持
默认情况,IDEA中创建项目时不支持Scala的开发,需要添加Scala框架的支持。
在项目名字上右键,选择scala,将scala安装目录配置进去

③ 创建类
package com.hike.bigdata.scala.chapter01
object Scala01_HelloWorld {
def main(args: Array[String]): Unit = {
System.out.println("Hello Scala World")
}
}
边栏推荐
- Where can I find a pre training model for pytoch model training?
- JS reverse request parameter encryption:
- Varnish foundation overview 1
- Varnish 基础概览5
- MySQL monitoring 5
- 【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向
- Module import reload method
- C语言 一元多项式求导
- Varnish foundation overview 5
- The first technology podcast month will be launched soon
猜你喜欢
![[machine learning Q & A] cosine similarity, cosine distance, Euclidean distance and the meaning of distance in machine learning](/img/34/367c66b8d10e896848b102a7f9aa89.png)
[machine learning Q & A] cosine similarity, cosine distance, Euclidean distance and the meaning of distance in machine learning

JS prototype and prototype chain (Lantern Festival meal)
![【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向](/img/b1/2afa73a14b2f41b7a65c4c2d261e6a.png)
【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向

JS reverse request parameter encryption:

【论文写作】英文论文写作指南

Unity2D--给动画添加关键帧并绑定事件

Cookie加密10

js逆向请求参数加密:

手势数字启蒙学习机

js返回内容被unicode编码
随机推荐
js内容混淆,返回内容加密
Cub school learning: manual query and ADC in-depth use
想转行,但不知道自己要做什么工作比较好?
Mysql 监控1
Conversion between opencv and image (valid for pro test)
[pytorch actual combat] generate confrontation network Gan: generate cartoon character avatars
Sklearn notes: make_ Blobs generate clustering data
Gesture digital enlightenment learning machine
当大学毕业感到迷茫怎么办?
Can mango hypermedia, which "braves the wind and waves", go ashore?
js Array.from()的5个便捷应用
[recommendation system] concise principle and code implementation of user based collaborative filtering
cookie加密11
[graph neural network] summary of graph classification study [3]: evaluation of graph classification methods and future research directions
Varnish foundation overview 6
Statsmodels notes STL
What to remember about the penalty for deduction of points in Item 1
ES6 one line code for array de duplication
MySQL monitoring 5
cookie加密9