- #1
haki
- 161
- 0
As far as I understand type systems in strongly typed system such as the one found in Java you must specify the exact type of the variable. Like e.g.
int x = 5; // strongly typed
also this would fail
Object x = 5;
Object y = "Not soo strong are we?";
Object z = x + y; // would throw a compiler error, since + operation is not defined on Object + Object, it is only defined on either Number + Number or String + String or String + Object
Now I said to a friend that C# is no longer strongly typed since in 3.0 you have the var variable which is more of a placeholder than a type, what kind of type is var? var can substitue any type therefore I would say that is weak type. He didn't agree on that one. I am left a bit puzzled. Is var type weak or not? I would say it is.
int x = 5; // strongly typed
also this would fail
Object x = 5;
Object y = "Not soo strong are we?";
Object z = x + y; // would throw a compiler error, since + operation is not defined on Object + Object, it is only defined on either Number + Number or String + String or String + Object
Now I said to a friend that C# is no longer strongly typed since in 3.0 you have the var variable which is more of a placeholder than a type, what kind of type is var? var can substitue any type therefore I would say that is weak type. He didn't agree on that one. I am left a bit puzzled. Is var type weak or not? I would say it is.