The difference between JavaScript and Java

Source: Internet
Author: User




First, they are the two different products developed by the two companies, and Java is a new generation of object-oriented programming language from Sun, which is especially suitable for Internet application development.
     


Second, JavaScript is Object-based, and Java is Object-oriented, meaning that Java is a true object-oriented language, and even if you are developing a simple program, you must design the object.
     JavaScript is a scripting language that can be used to create complex software that is independent of the network and interacts with the user. It is an object-and event-driven programming language.
     


Thirdly, the two languages do not perform the same way in their browsers. Java's source code must be compiled before it is passed to the client, so the client must have an emulator or interpreter on the appropriate platform.
     It can be implemented by a compiler or interpreter that is independent of the binding of a particular platform compiler code. JavaScript is an explanatory programming language whose source code does not need to be compiled before it is sent to the client.
     


The variables adopted in the two languages are not the same. Java uses strongly typed variables to check that all variables must be declared before they are compiled. A variable declaration in JavaScript with its weak type.
     That is, the variable does not need to be declared before it is used, but rather the interpreter checks its data type at run time.


Five, the code format is not the same. Java is an HTML-independent format that must be loaded by referencing an external media like HTML, and its code is stored in a separate document in the form of a byte code.
     

Six, the embedding method is different. In an HTML document, the identities of the two programming languages are different, JavaScript uses <script>...</script> to identify, and Java uses <applet> ... </applet> to identify.


VII, static binding and dynamic binding. Java uses static linking, meaning that Java object references must be made at compile time, so that the compiler can implement strong type checking. JavaScript uses dynamic linking,
      That is, JavaScript object references are checked at run time and cannot be checked for object references without compiling.

The difference between JavaScript and Java

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.