If I have the com.example
package, I can create a class in this package as follows:
package com.example { class MyClass }
or like this:
package com { package object example { class MyClass } }
In both cases, the resulting class (at least with respect to the other Scala code) is com.example.MyClass
.
Of course, there are random differences. In the first case, the resulting compiled class is com/example/MyClass.class
, while in the second it is com/example/package$MyClass.class
, but are there any significant differences?
Paul butcher
source share