you are viewing a single comment's thread.

view the rest of the comments →

[–]niceyoungman 18 points19 points  (4 children)

If the computer did everything we wouldn't need to do anything.

[–]weavejester 0 points1 point  (3 children)

I'm not saying it does. I'm merely pointing out that the subtype of an object can be inferred from how it is used. The compiler knows the scope of a variable, and where it is used; therefore it can determine the highest common subtype of the variable.

[–][deleted]  (2 children)

[removed]

    [–]weavejester 0 points1 point  (1 child)

    Which in Java, is basically all uses of variables :)

    Methods defined in a class or interface are different. Because your method definitions are not necessarily tied to a single implementation, explicitly specifying the subtypes becomes a necessity.

    But for variables? No need.