M.Regmi M.Regmi - 24 days ago 10
Scala Question

What is the difference between Future and future?

I am new to scala.In Future, I saw it used in two different way i.e Future and future.

Example:

val sayHello = Future {
Thread.sleep(1000)
"hello"
}


Similarly,

val sayHello = future {
Thread.sleep(1000)
"hello"
}


But I didn't find any difference in Output. I will be pleased if anybody

makes it clear to me.

Answer

It is the same thing indeed, and future (lowercase) is actually deprecated since 2.11.0.

See the actual code in scala lang: https://github.com/scala/scala/blob/v2.12.0/src/library/scala/concurrent/package.scala#L101