Hello World Program in Scala - The Coding Shala

Home >> Learn Scala >> Hello World Program

 In this post, we will learn how to write Hello World Program in Scala programming language.

Hello World Program in Scala

The following Scala program will print "hello world".

Scala Program: 

// scala program to print hello world
object HelloWorld {
  def main(args: Array[String]){
    println("hello world");
  }
}

The Program has 3 main components:
  1. Object: Object is the keyword used to create objects. here HelloWorld is an object.
  2. Function: def keyword is used to define the function in Scala. here main is the function, it also starting point in scala like Java.
  3. Println: Println is a method in scala that is used to display the output in the console.

Other Posts You May Like
Please leave a comment below if you like this post or found some errors, it will help me to improve my content.

Comments

Popular Posts from this Blog

Shell Script to find sum, product and average of given numbers - The Coding Shala

Shell Script to Create a Simple Calculator - The Coding Shala

Add two numbers in Scala - The Coding Shala

New Year Chaos Solution - The Coding Shala

Richest Customer Wealth LeetCode Solution - The Coding Shala