Android Scala literal identifiers require explanation (backticks)

mishrajicoder

New Member
I was reading Programming in Scala 2nd Edition when I came across this:
"The notion is that you may insert any string that the runtime accepts as an identifier between backticks."
I'm not sure why I'd want to utilize this. In this article, I've read provided an example of how to access the static yield function in Java's Thread class.
So, because yield is a reserved term in Scala, if I use yield with backticks,
Code:
Thread.`yield`()
Would disregard the Scala yield and allow me to use the yield function of the Java Thread class instead?
Thank you!
 

AlishS

New Member
Yes, that is correct. By putting the word 'yield' in backticks, you are telling the Scala compiler to use the yield function from the Java Thread class instead of the Scala one. This allows you to access features from Java classes that might otherwise be unavailable in Scala due to name collisions. The additional resource might be helpful.
 

mikepalma

Member
A software development company has the capabilities to help your business get a competitive edge. It can analyze the customer pain points and predict future demand. Using a custom software solution will save you time and money in the long run. It will also allow you to integrate the best data protection protocol and optimize your product https://mlsdev.com
 
Top