score:12
Accepted answer
you can't.
yes, import java.util.{calendar => cal}
is really your best bet.
conceptually, scala object
members are similar to static members of java classes. this might suggest the following would work, but it doesn't since there are actually no singleton objects available for java classes.
scala> val cal = java.util.calendar
<console>:13: error: object calendar is not a value
val cal = java.util.calendar
^
Source: stackoverflow.com
Related Query
- How to access a Java static method from Scala given a type alias for that class it resides in
- How to invoke public static method for existing Java class instance from Scala?
- How to declare scala method so that it can be called from Java using varargs style
- no access to a java static method from scala
- Scala 2.12.4: Cannot access protected static Java method from another package anymore
- scala - how to access a case class method from another class?
- How to access a public static final member in a Java class from Scala?
- Access from Java a Scala object that inherits from a generic Java base class
- Calling Java method that doesn't take a generic type from Scala
- scala - How to call public static method defined in Java from Scala?
- How do I create a class hierarchy of typed factory method constructors and access them from Scala using abstract types?
- How to write a toCSV method for scala case class that would generate the csv string for the class?
- How can I make a scala method parameter type that is a collection of multiple types that can be converted to a given type?
- How does the Scala program compile, given that bindAndHandle method takes the first parameter of type Flow not Route?
- How to call a Scala method that has Numeric parameter from Java
- How do I access a "getter" of a Java method from a scala method?
- How do I access a Java static member from Scala with reflection?
- Cannot access a Java static method from Scala
- How to reach to static method from class instance for mock
- How to define a method in Scala that returns a Java object?
- Any way to obtain a Java class from a Scala (2.10) type tag or symbol?
- How to write copy() method for Simple Class in Scala
- How to call main method of a Scala program from the main method of a java program?
- How to refer to protected inner class in Scala when inheriting from Java (with byte code only)
- How to define a scala method with type param that cannot be Any
- How to add a factory method to an existing Java class in Scala
- How to get Scala annotations that are given to an argument of a method
- Calling a protected static Java method from Scala
- Scala Puzzle: enforcing that two function arguments are of the same type AND both are a subtype of a given class
- Calling Java Generic Typed Method from Scala gives a Type mismatch error : Scala
More Query from same tag
- Use java.util.Map from Scala
- Compile error on a Scala project: object _ is not a member of package _
- Scala/Spark Select Column very slow
- Resolve implicit parameter from super type
- How to parse json having a nested schema?
- Histogram Issue in spark Scala
- Dealing with JSON in Scala?
- Java Timestamp Issue in Scala - java.lang.IllegalArgumentException Error obtained
- Combining Scala Option[Iterable[_]]
- Spark sql and hive causing "Error: Could not find or load main class"
- How to set up logging level for Spark application in IntelliJ IDEA?
- Akka testing - sender is deadLetters
- Flink Scala Job Runtime Error : java.lang.NoSuchMethodError
- Can a Scala class extend multiple classes?
- can't write an avro file
- Find the smallest value in an array excluding 0
- Scala - Combinator Parsing, order of alternatives seems to matter
- List of upcoming Six months including this month
- Initializing a 2D (multi-dimensional) array in Scala
- Is it required to explicitly stop an Akka actor from supervisor?
- How to vectorize DataFrame columns for ML algorithms?
- Play 2.0 Comet using a persistant connection
- SQLite support in SORM?
- Using SBT with scala using offline dependencies
- Update column value from another columns based on multiple conditions in spark structured streaming
- Is there any way to pimp a library in Scala 3 except implicits?
- Better Alternatives to EXCEPT Spark Scala
- What compromises Scala made to run on JVM?
- play framework reading file from conf folder with routing
- mvn scala:script -DscriptFile=scripts/PrintHello.scala --> Does scripts folder to be part of the project?