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.