What is a dynamic language?
Dynamic language means that a program can change its structure at run time: New functions can be introduced, existing functions can be deleted, and so on structure changes. JavaScript, for example, is a typical dynamic language.
In addition, such as Ruby, Python, OC and so on are also dynamic languages, and C, C + +, Java, C # and other languages are not dynamic language.
Dynamic type language, that is, the type of check is done at run time, is not legitimate to be judged at runtime, such as JavaScript there is no compile error, as long as the run error.
JavaScript changes the structure of small examples:
aall[0].onclick=function() { // by re-assigning the class name to show the effect of the hidden menu if( oart.classname== ' no_circle ') { oart.classname= ' yes_circle ' }else{ oart.classname= ' no_circle ' }}
Static Languagewhile the type judgment of the static type language is judged before running (such as the compile phase), such as C #, Java is static type language, static type language in order to achieve polymorphism will take some type of authentication means, such as inheritance, interface, and dynamic type language does not need,key Benefits of a static type language : is that its structure is very standard, easy to debug, convenient type safety;Disadvantages:it is necessary to write more type-related code, which is not easy to read and unclear. The advantage of dynamic type language is that it is convenient to read, do not need to write a lot of type related code, the disadvantage is that it is inconvenient to debug, the naming is not standard will cause the reading does not understand, is not conducive to understanding and so on.
Why Java can be called "quasi-Dynamic language"?
reflected in the following aspects:
1. Reflection mechanism
2. Dynamic compilation
3. Dynamically executing JavaScript code
4. Dynamic byte-code operation
5. Dynamic conversion Type
The reflection mechanism of Java is considered to be a key property of Java as a quasi-dynamic language, which allows the program to obtain the internal information of any known name class through reflection at runtime, including:
The property information for the class that is running,
method information for the class that is running,
The construction information for the class that is running,
The access modifiers, annotations, and so on for the class that is running.
Dynamic language is dynamic in its time, while static language is approaching to make up for the defect of static language through other methods.
Why can you say that the Java language is a quasi-dynamic language?