Day6实习日记

Scala 学习

Scala 是 Scalable Language 的简写,意味着这种语言设计上支持大规模软件开发,是一门多范式的编程语言

Scala 运行于 Java 平台(Java 虚拟机),并兼容现有的 Java 程序。

Scala 的编译模型(独立编译,动态类加载)与 Java 和 C# 一样,所以 Scala 代码可以调用 Java
类库(对于.NET实现则可调用.NET类库)。


HelloWorld
通过创建一个 HelloWorld.scala 的文件来执行代码,代码如下所示:

object HelloWorld {
   /* 这是我的第一个 Scala 程序
    * 以下程序将输出'Hello World!'
    */
   def main(args: Array[String]) = {
      println("Hello, world!") // 输出 Hello World
   }


标识符
Scala 可以使用两种形式的标志符,字符数字和符号。

字符数字使用字母或是下划线开头,后面可以接字母或是数字,符号"$“在 Scala 中也看作为字母。然而以”$“开头的标识符为保留的
Scala 编译器产生的标志符使用,应用程序应该避免使用”$"开始的标识符,以免造成冲突。

Scala 的命名规则采用和 Java 类似的 camel 命名规则,首字符小写,比如
toString。类名的首字符还是使用大写。此外也应该避免使用以下划线结尾的标志符以避免冲突。符号标志符包含一个或多个符号,如+,:,?
等,比如:+ ++ ::: < ?> :->


变量

在 Scala 中,使用关键词 “var” 声明变量,使用关键词 “val” 声明常量。

不可变变量 (val):

使用 val 关键字声明的变量是不可变的,即一旦赋值后,其值不能再被改变。 类似于 Java 中的 final 变量。
可变变量 (var):

使用 var 关键字声明的变量是可变的,其值可以在程序的生命周期内多次改变。 类似于 Java 中的普通变量。

var myVar : String = "Foo"
var myVar : String = "Too"
  • 9
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Day 1: Today is my first day of computer internship. I am excited to learn and gain more experience. My mentor introduced me to the company’s software and hardware tools. Day 2: I learned the basics of programming languages like C++ and Python. My mentor guided me through some coding exercises to make sure I understood the concepts. Day 3: Today, I was introduced to database management systems. I learned how to use SQL to query, update and manage data in a relational database. Day 4: I spent the day working on a project using Java programming language. I learned how to implement object-oriented programming concepts and how to use Java libraries. Day 5: I learned about web development and how to create a simple website using HTML and CSS. I also learned about responsive design and how to make a website compatible with different devices. Day 6-10: I spent these days working on a group project. We developed a simple mobile application using Android Studio. I learned how to design user interfaces and how to integrate different functionalities into the app. Day 11-15: I worked on a project that involved data analysis using Python. I learned how to use libraries like NumPy, Pandas and Matplotlib to analyze and visualize data. Day 16-18: I worked on a cybersecurity project. I learned about different types of attacks and how to prevent them. I also learned how to use penetration testing tools. Day 19: I spent the day improving my coding skills by practicing coding challenges on different online platforms. Day 20: Today is my last day of internship. I am grateful for the opportunity to learn and gain experience. I am now more confident in my coding skills and ready to take on more challenging projects.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值