The relationship between Java and JavaScript

Source: Internet
Author: User

Java and JavaScript are two different programming languages.

It is generally believed that at that time Netscape named LiveScript as JavaScript because Java was the most popular programming language at the time, with the name "Java" contributing to the spread of the new language.

The similarities include:

Their grammar and C language are very similar;

They are object-oriented (although the way they are implemented is slightly different);

JavaScript references Java's naming conventions at design time;

The differences between them include:

JavaScript is a dynamic type language, while Java is a static type language;

JavaScript is a weak type, Java is strongly typed;

JavaScript object-oriented is based on the prototype (prototype-based) implementation, Java is based on the class (class-based);

JavaScript is a far cry from the way Java is compared. JavaScript is designed to refer to objects that do not include Java, but include languages such as self and Scheme.

Same point:

1. Memory management, both of which use GC to recycle memory. So Java is very similar to JavaScript's memory leaks.

2. The code is compiled into machine code and executed by the middleware: Java is compiled into bytecode before it is executed by the JVM, and the V8 engine uses JIT to compile JS into machine code and is executed by the engine.

3. The memory request, object (objects), and array (arrays) are referenced from the stack (stack), and its own space is applied from the heap (heap).

4. Hash processing, array and object, numeric type key value hashcode for itself, the string type key needs to calculate hashcode to find the corresponding value, so the length of the property name determines its type in the hash class container performance, there are problems in Java.


The relationship between Java and JavaScript

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.