当前位置: 首页 > 工具软件 > scala-steward > 使用案例 >

scala编程_Scala概述| Scala编程教程

尉迟宪
2023-12-01

scala编程

Scala is a programming language developed by Martin Odersky. It came into the market in 2003. Scala Stands for Scalable Language. Scala is a JAVA based programming Language which is much easier to code than Java. So is treated as future replacement of Java in enterprise software development.

Scala是 Martin Odersky开发的一种编程语言 。 它于2003年投放市场。Scala代表可扩展语言 。 Scala是一种基于Java的编程语言,比Java更容易编码。 因此被视为企业软件开发中Java的未来替代品。

Features of scala programming language

Scala编程语言的功能

Some features of Scala are:

Scala的一些功能包括:

  • It runs on JVM but compiler is different.

    在JVM上运行,但编译器有所不同

  • Integrates Features of both Object-Oriented Programming and Functional Programming.

    集成了面向对象编程和函数式编程的功能

  • Lazy Computation, it increases performance, the expression evaluates only when its evaluation is required.

    延迟计算,它提高了性能,仅在需要评估时才对表达式进行评估。

  • Immutability: it means the value of a data cannot be changed by default.

    不变性 :这意味着默认情况下无法更改数据的值。

  • Case Classes and Pattern Matching.

    案例分类和模式匹配。

  • Type Interface: It recognizes data type and functions return type itself.

    类型接口 :它识别数据类型,函数本身返回类型。

  • Concurrency Control: Scala Provide concurrency control using actor model.

    并发控制 :Scala使用actor模型提供并发控制。

  • High Order Function: A function that works on another function.

    高阶功能 :可以在其他功能上使用的功能。

Coding in Scala is easier than Java and it saves a lot of coding because of the above feature and gives a more efficient program.

Scala中的编码比Java容易,并且由于上述功能,它节省了大量代码,并提供了更高效的程序。

Scala is a general-purpose language can be used anywhere. It runs on JVM that means its byte code can replace java. So, Java Application can be made using Scala also.

Scala是一种通用语言,可以在任何地方使用。 它在JVM上运行,这意味着其字节码可以代替java。 因此,也可以使用Scala来创建Java应用程序。

安装Scala (Installation of Scala)

Scala installation is very easy. It can be installed on both Windows and Linux based systems. As it sits on top of Java, it requires Java to be installed on your system before installation.

Scala的安装非常简单。 它可以安装在基于Windows和Linux的系统上。 由于它位于Java之上,因此需要在安装系统之前先将Java安装在系统上。

Requirement: JAVA 1.8 Or Above

要求: JAVA 1.8或更高

Steps to Install

安装步骤

Step 1: Check for Java on your System, Run the following command in your Command Prompt or Terminal

步骤1:在系统上检查Java,在命令提示符或终端中运行以下命令

    For Windows , \>java –version
    For Linux, $java –version

If you have Java installed on your system the version of Java Will prompt otherwise you need to install java on your system.

如果您的系统上安装了Java,则Java版本将提示您,否则需要在系统上安装Java。

Just Go To oracle, Menu -> Product -> Java.

只需转到oracle,菜单->产品-> Java。

Step 2: Set your java environment variable JAVA_HOME to your java install location.

步骤2:将Java环境变量JAVA_HOME设置为Java安装位置。

    For this use the following Command, 
    For Windows, Set JAVA_HOME to C:\ProgramFiles\java\jdk1.7.0_60
    For Linus, Export JAVA_HOME=/usr/local/java-current

Step 3: Install Scala, download Scala from https://www.scala-lang.org/download/
A jar file will download. After it's Downloaded Run the command to install this Jar File on your system,

第3步:安装Scala,从https://www.scala-lang.org/download/下载Scala
一个jar文件将下载。 下载完成后,运行命令在系统上安装此Jar文件,

    For Windows, \>java –jar scala-2.11.5-installer.jar\>
    For Linux, $java –jar scala-2.9.0.1-installer.jar

Check for Scala installation on your system using following commands,

使用以下命令检查系统上的Scala安装,

    For Windows , \>scala –version
    For Linux, $scala –version

翻译自: https://www.includehelp.com/scala/overview-of-scala-programming-tutorial.aspx

scala编程

 类似资料: