java.util.GregorianCalendar.getInstance();
Works in Java
java.util.Calendar.getInstance();
Works in Scala
java.util.GregorianCalendar.getInstance();
Fails in Scala. getInstance is not a member of object java.util.GregorianCalendar
There are no static in scala, rather there are in singleton objects and methods in them, and so they are not considered inherited, even when defined in java. getInstance
is defined on Calendar
. In java, calling it on GregorianCalendar
does call the exact same method as calling it on Calendar
. In scala, you have to call it on Calendar
. (BTW, calling it on GregorianCalendar in java is rather misleading)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With