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 Create a Simple Calculator - The Coding Shala

N-th Tribonacci Number Solution - The Coding Shala

Java Program to Convert Binary to Decimal - The Coding Shala

LeetCode - Shuffle the Array Solution - The Coding Shala

Java Program to Find GCD or HCF of Two Numbers - The Coding Shala