简单地说就是这样:在静态类型语言中,类型是static,这意味着一旦将变量设置为类型,就无法更改它。那是因为类型是与变量关联的,而不是变量所引用的值。例如在Java中:String str = "Hello"; //statically typed as stringstr = 5; //would throw an error since java is statically typed而在动态类型语言中,类型是dynamic,这意味着在将变量设置为类型之后,可以对其进行更改。这是因为键入与值而不是变量相关联。例如在Python中:str = "Hello" # it is a stringstr = 5 # now it is an integer; perfectly OK另一方面,某种语言中的强/弱键入与隐式类型转换有关(部分取自@Dario的答案):例如在Python中:str = 5 + "hello" # would throw an error since it does not want to cast one type to the other implicitly. 而在PHP中:$str = 5 + "hello"; // equals 5 because "hello" is implicitly casted to 0 // PHP is weakly typed, thus is a very forgiving language.静态类型允许在编译时检查类型正确性。通常编译静态类型的语言,并解释动态类型的语言。因此,动态类型的语言可以在运行时检查类型。