Comparison of Java and JavaSciprt

JavaScript and Java are different products developed by the two companies. Java is the object-oriented programming language launched by the original Sun; JavaScript is a product of Netscape, which is an object-based and event-driven interpretation that can be embedded in Web pages and developed to extend the functionality of the Netscape browser Sexual language, its predecessor is LiveScript; and Java's predecessor is Oak language.

1. Comparison between Java and JavaSciprt:

(1) Object-based and object-oriented:

Java is a true object-oriented language, even if you are developing simple programs, you must design objects

JavaScript is a scripting language that can be used to make complex software that has nothing to do with the network and interacts with users. It is a programming language based on Object-Based and Event-Driven. Therefore, it provides a very rich internal objects for designers to use

(2) Explanation and compilation:

Java source code must be compiled before execution

JavaScript is an interpreted programming language, its source code does not need to be compiled, and is interpreted and executed by the browser

(3) Strongly typed variables and weakly typed variables

Java uses strong type variable checking, that is, all variables must be declared before compilation

Variable declaration in JavaScript uses its weak type. That is, the variable does not need to be declared before use, but the interpreter checks its data type at runtime

(4) The code format is different

(5) The main difference

The most important difference between Java and JavaScript is that one is a static language and the other is a dynamic language.

The current development trend of programming languages ​​is functional languages ​​and dynamic languages. Classes are first-class citizens in Java, and functions are first-class citizens in JavaScript.

 

Guess you like

Origin www.cnblogs.com/zhai1997/p/12728464.html