We have Jython
, JRuby
, Groovy
which are dynamically typed and runs over JVM
. I understand that these languages compile to bytecode.
Other languages such as Scala
supports type inference, and its clear that the compiler infers the type for us.
But Java
is a static language and it compiles to bytecode, does this mean bytecode supports dynamic typing?
For e.g. In Java
we need to declare the variable type at compile time, and can never change it. But in case of Python
we dont have to declare a type, but we can assign any type of value to the same variable during run time.
How does the dynamic typing work over a static language?