JavaScript and Java are two different products developed by two companies.
Java is an object-oriented programming language launched by the original Sun Microsystems company, which is particularly suitable for Internet application development; (Recommended to learn : java course)
And JavaScript is a product of Netscape. It is an object-based and event-driven interpretation developed to extend the functions of the Netscape browser that can be embedded in Web pages. Sexual language.
The predecessor of JavaScript is LiveScript; and the predecessor of Java is Oak language.
The following is a comparison of the similarities and differences between the two languages:
Object-based and object-oriented:
JAva is a true object-oriented language. Even to develop simple programs, objects must be designed; JavaScript is a scripting language that can be used to create complex software that has nothing to do with the network and interacts with users.
It is an Object-Based and Event-Driven programming language, so it itself provides a very rich set of internal objects for designers to use.
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. (Nearly all current browsers use JIT (just in time compilation) technology to improve the running efficiency of JavaScript)
Strong type variables and type weak variables:
Java uses strong type variable checking, that is, all variables must be declared before compilation; variables in JavaScript are weakly typed, and even variables do not need to be declared before using them. The JavaScript interpreter checks and infers its data type at runtime. .
The code format is different.
The above is the detailed content of The difference between java and javascript. For more information, please follow other related articles on the PHP Chinese website!