// Java claims to be statically typed, but how much so? public class statictype { public int f(int x) { if (x>0) return 1; else return (Integer)(Object)"not positive"; } // this sucker compiled public static void main(String[] args) { new statictype().f(-1); } } /* Static typing is supposed to have the following advantages. 1. Safety. Get compiler errors for typing mistakes. 2. Less runtime overhead Unfortunately, "static typing" as implemented in a typical OOP language is actually quite weak. The exact type of objects is not known until runtime. This means the compiler is less capable of guaranteeing safety AND there is still runtime overhead! Languages like Java can really only guarantee dynamic safety. */