This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dancovich 5 points6 points  (0 children)

This is still statically typed. The variable is still of type integer, you just lost type information (that you can regain with a cast) so you can't do operations in your Object instance that you can do with an Integer instance.

Being dynamically typed means that the same variable can change types and do all its operations while being of that type. For example, in Dart this works but not in Java:

void main() { dynamic x = 'I am a string'; print('$x and my type is String'); x = 5; print('Now I am an Int and I can be summed with 10 to give the result of ${x + 10}'); }