Flat 20% & up to 50% off + Free additional Courses. Hurry up!

Hello Program in Scala


It includes both an interpreter and compiler. The compiler generates a .class file that is binary files that can be executed by the JVM whereas the interpreter executes source code contained in a text file or it can be used to work interactively with Scala. A simple program in scala is shown as follows:-

object HelloIntellipaat {

def main(args: Array[String]) {

println("Hello Intellipaat")



The identifier args refers to the command line arguments, main is a predefined. Suppose this code is stored in HelloIntellipaat.scala. The command which is used to compile and execute the .class file is as follows:

$ scalac HelloIntellipaat.scala

$ scala HelloIntellipaat


Hello Intellipaat


Dollar sign represents the command line prompt and -classpath specifies the location of one or more .class files. If user wants to use the interpreter and is working on a UNIX system or a Unix-like system such as OpenSolaris or linux respectively use the following code:


exec scala "$0" "$@"


println("Hello Intellipaat")


or the following code:


exec scala "$0" "$@"


object HelloIntellipaat {

def main(args: Array[String]) {

println("Hello Intellipaat " + args.toList)




in a text file, say HelloIntellipaat. The program can be executed by entering the following command:

$ hello


The two versions presented do not produce exactly the same output. For example the second version will print the following output

Hello Intellipaat List()

On Windows systems users can get same results by creating a text file say hello.bat which  contains the following code:


@echo off

call scala %0 %*

goto :eof


rem *

rem Scala code follows

rem *

println("Hello Intellipaat")

This program can be executed from a CMD shell by entering a command like the following one:

C:\My Programs>HelloIntellipaat.bat

Type scala in command prompt to start scala interpreter –

$ scala

Welcome to Scala version 2.11.7.final (Java HotSpot(TM) Server 64-Bit VM, Java 1.6.0_18).

Type in expressions to have them evaluated

Type: help for more information.


scala> var x=20

x: Int = 20


scala> ("intellipaat").length

res1: Int = 11

This blog will help you get a better understanding of Significance Of Scala!

"0 Responses on Hello Program in Scala"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.


Sales Offer

  • To avail this offer, enroll before 24th October 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
DW offer

Sign Up or Login to view the Free Hello Program in Scala.