What is the use of PreDef in Scala?
-
- Site Admin
- Posts: 186
- Joined: Wed Jul 16, 2014 9:22 pm
- Contact:
What is the use of PreDef in Scala?
What is the use of PreDef in Scala?
-
- Site Admin
- Posts: 186
- Joined: Wed Jul 16, 2014 9:22 pm
- Contact:
Re: What is the use of PreDef in Scala?
- The Predef object provides definitions that are accessible in all Scala compilation units without explicit qualification.
- defined in scala package as “scala.PreDef”. It is an utility object.
It defines many utility methods as shown below:
For instance, print, println, readLine, readInt, require etc methods are defined in PreDef object.
PreDef is available to use its methods without importing in all Scala Programs because Scala Compiler imports this object into all compilation units like Class, Object, Trait automatically.
https://www.journaldev.com/8958/scala-i ... ns-answers
- defined in scala package as “scala.PreDef”. It is an utility object.
It defines many utility methods as shown below:
Console IO (print,println etc)
Collection utility methods
String utility methods
Implicit conversion methods
Assertion utility methods etc.
For instance, print, println, readLine, readInt, require etc methods are defined in PreDef object.
PreDef is available to use its methods without importing in all Scala Programs because Scala Compiler imports this object into all compilation units like Class, Object, Trait automatically.
https://www.journaldev.com/8958/scala-i ... ns-answers
Return to “Core Java, Scala, Python and Advanced Programming or development”
Who is online
Users browsing this forum: No registered users and 2 guests