What is Statically typed language and Dynamically typed language?


According to the delineation of the type of the variable either in compile time or in runtime, the programming language are differenciated into two groups statically typed language and dynamically typed language.

The variable type of Statically typed language cannot be changed. The type of the variable is associated with the variable rather than the value it refers. For example the language like java, c++, FORTRAN, pascal , Scala etc are statically typed language. In these type of programming language once a variable is defined with a type and if we tried to change it to another type there occurs a type error in compile- time.

For example : in java

String type =”String”; //variable type defined as string variable

Type=123; // compile-time error

On the other hand, varables of dynamically typed language are typed checked at run-time and the type of the variables is associated with the value of the variables therefore the variable type can be changed. For example the languages like Ruby, Objective C, Javascript, PHP, python etc. are dynamically typed language.

For example: python

integerdata = 10;

integerdata = “Hello World!”; // no type error occurred

Statically typed and dynamically typed language are again sub-divided into two sub groups weak and strongly typed language.


Please enter your comment!
Please enter your name here