Scala is a multi-paradigm (supports different programming styles and is dynamic in nature.) programming language. Scala is object-oriented, and also supports functional programming approaches.
The primitive data concept (collection of basic data types from which other data types are derived or constructed) does not exist here. Scala was created in the year of 2003 by Martin Odersky. Scala programming language is also known as Scalable Language.
Program 1: Scala Program To Print “Hello World”
object divineseo{
def main(args:Array[String]){
println ("Hello World")
}
}
Object: Object is a Keyword that is used to create the object. In my case, my object name is “divineseo”. You can name it anything you want.
def main(args: Array[String]): def is the keyword that is used to define the function like in Python language. “main” is the name of the main method. (args:Array[String]) is for command line arguments.
printIn: It is used to display the output on the output console screen.
Output
Hello World
We are using scala because of its object-oriented approach. First, we create an object named “divineseo” and then we define the main function. That main() is work as an entry point of the program. Inside the main function, we print the message “Hello world” using printIn command.