Skip to content

Functional Object in Scala

Functional objects are objects that do not have any mutable state.Along the way, this blog on functional  object will  show you more aspects of object-oriented programming in Scala: class parameters and constructors, methods and operators, private members, overriding, checking preconditions, overloading, and self references.

Difference Between var and val

var firstString=”I am a String”

firstString=”I can be Changed” // Code will Compile

val secString=”I am also a String”

secString=”But I cannot br changed” // Code will not complie

Features Of Scala

  • Concise
  • Object Oriented
  • Scala Runs on the JVM
  • Functional Programming
  • All Types are object
  • Type Inference
  • Functions are object
  • Support Nested Functions.

Write a class in scala

A class is the blueprint from which individual objects are created. Once you define a class, you can create
objects from the class blueprint with the keyword new. For example, given
the class definition:

class MyFirstScalaClass {
 println("This is my First Scala Class")
 }

You can create MyFirstScalaClass objects with:


val myFirstScalaClass = new MyFirstScalaClass

What is scala

Scala is a blend of object-oriented and functional programming concepts in a statically typed language. The name Scala stands for “scalable language.” Scala has been created by Martin Odersky and he released the first version in 2003.

Welcome in Scala’s World

Hello Scala,

Scalability is influenced by many factors, ranging from syntax details to
component abstraction constructs. If we were forced to name just one as-
pect of Scala that helps scalability, though, we’d pick its combination of
object-oriented and functional programming