Why can you say that the Java language is a quasi-dynamic language?

Source: Internet
Author: User

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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.