欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 新车 > Scala day6(Class,field,Single Object)

Scala day6(Class,field,Single Object)

2025/8/8 1:25:55 来源:https://blog.csdn.net/weixin_43408020/article/details/147598290  浏览:    关键词:Scala day6(Class,field,Single Object)

Foreword【こんにちは】

Today, we continue to learn Scala Language, though the Scala isn’t easy for Begainner, Big Data Technology need Scala Language, Spark【Distributed Calculation FrameWork】is based on Scala Language designed. I know the learning road has all kinds of difficults, please you believe in only you insist to study it at last, you could become winner in the game.

Text【本】

object day5 {//The Codes in day5.scaladef main(args:Array[String]): Unit = {System.out.println("Scala is make me happy!!");val example = new examexample.calc(45,25)System.out.println();val example2 = new exam2("abc",123)example2}class exam {var sum = 0;def calc(num:Int,num2:Int): Unit = {sum = num + num2;System.out.println("num = "+num);System.out.println("num2 = "+num2);System.out.println("Sum(num,num2) = "+sum);}}class exam2(digit:String,num:Int) {System.out.println("The first parameter is "+digit);System.out.println("The second parameter is "+num);}
}

The output result:
在这里插入图片描述

The above Codes introduce the Class, field, Single Object. We start to analysize them.
Class have parameters or haven’t parameters both executablely. Field is variable in Class, Single Object is haven’t any parameters.

In the end【さよなら】

I gratitude for みんな watch my articles, my passages maybe have some mistakes, if you could point them, I truely thanks for you. Big Data Technology must learn the Scala Language, please you believe in anything both difficult at first. But you need overcome them and you will become the winner in this game. Your Pan【One low quality man of human】, My name have bread meaning at JaPanese Language【パン】, it sounds interesting, hhh.

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词