Is it optional to import Java packages in Scala? -


i find following scala program works ok without importing "java.lang.thread" (scala version 2.11.6):

object threadsmain extends app {     val t: thread = thread.currentthread()     val name = t.getname()     println(s"$name") } 

the output is:

main 

does mean there no need including java packages in scala program explicitly? or there rules?

as explained on scala homepage imports java.lang done automatically whereas other classes have imported explicitly.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -