1.

What Is The Use Of ‘???’ In Scala-based Applications?

Answer»

This ‘???’ three question marks is not an operator, a method in Scala. It is used to MARK a method which is ‘In PROGRESS’ that means Developer should PROVIDE implementation for that one.

This method is define in scala.PreDef class as shown below:

def ??? : Nothing = throw new NotImplementedError

If we RUN that method without providing implementation, then it throws ‘NotImplementedError’ error as shown below:

scala> def add(a:Int, b:Int) : Int = ???
add: (a: Int, b: Int)Int
 
scala> add(10,20)

scala.NotImplementedError: an implementation is MISSING

This ‘???’ three question marks is not an operator, a method in Scala. It is used to mark a method which is ‘In Progress’ that means Developer should provide implementation for that one.

This method is define in scala.PreDef class as shown below:

def ??? : Nothing = throw new NotImplementedError

If we run that method without providing implementation, then it throws ‘NotImplementedError’ error as shown below:

scala> def add(a:Int, b:Int) : Int = ???
add: (a: Int, b: Int)Int
 
scala> add(10,20)

scala.NotImplementedError: an implementation is missing



Discussion

No Comment Found