In php/perl we can simply say $a='hi" and then $a=1 without needing to declare its type. But there are type casting errors in java for the same.
Why this difference?
In php/perl we can simply say $a='hi" and then $a=1 without needing to declare its type. But there are type casting errors in java for the same.
Why this difference?
PHP is dynamically typed, while Java and C are statically typed.
With static typing, type checking can be done at compile time and this can catch many errors, so it's not necessarily a bad thing. This also allows them to be much faster than dynamic languages.