问题
I have a Java class which I'm working with in Scala. I can instantiate the class, but I don't see how to instantiate a public static
class within the outer class from Scala. Can anyone point me to the answer?
(I've read lots of posts that say how to use "static" members in Scala code. That is not what I'm looking for.)
回答1:
In my case something like that works:
Java class
package test.java; public class Test { public static class TestInner {} }
Scala class
package test.scala import test.java.Test object Main { def main(args: Array[String]): Unit = { new Test.TestInner() } }
来源:https://stackoverflow.com/questions/42322033/from-scala-access-static-inner-class-of-java-class