java has nothing to do with javascript; Java is an object-oriented programming language that can write desktop applications, Web applications, distributed systems and embedded system applications, etc.; and javascript is a A function-first lightweight, interpreted or just-in-time compiled programming language.
The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer
What is the relationship between java and javascript?
Java has nothing to do with javascript.
Java and JavaScript are two popular languages at present. On the surface, the names of the two are very similar, so many beginners tend to confuse the two, or directly classify them into the same category. In fact, they are not. Although the two are closely related, they are two completely different languages.
Java is an object-oriented programming language. It not only absorbs the various advantages of the C language, but also abandons the concepts such as multiple inheritance and pointers that are difficult to understand in C. Therefore, the Java language has powerful functions and Simple and easy to use two features. As a representative of static object-oriented programming languages, Java language perfectly implements object-oriented theory and allows programmers to perform complex programming with an elegant way of thinking.
Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, and dynamics. Java can write desktop applications, Web applications, distributed systems and embedded system applications, etc.
JavaScript ("JS" for short) is a lightweight, interpreted or just-in-time compiled programming language with function priority. Although it is famous as a scripting language for developing Web pages, it is also used in many non-browser environments. JavaScript is based on prototype programming, a multi-paradigm dynamic scripting language, and supports object-oriented, imperative, declarative, and functional programming paradigm.
JavaScript was first designed and implemented on the Netscape Navigator browser in 1995 by Brendan Eich of Netscape. Because Netscape was working with Sun, Netscape management wanted it to look like Java, hence the name JavaScript. But in fact its grammatical style is closer to Self and Scheme.
The standard for JavaScript is ECMAScript. As of 2012, all browsers fully support ECMAScript 5.1, and older browsers support at least the ECMAScript 3 standard. On June 17, 2015, ECMA International released the sixth edition of ECMAScript, which is officially called ECMAScript 2015, but is usually called ECMAScript 6 or ES2015.
JavaScript was originally inspired by Java and was designed. One of the purposes is to "look like Java", so there are similarities in syntax, and some names and naming conventions are also borrowed from Java. But the main design principles of JavaScript are derived from Self and Scheme.
The similarity in names between JavaScript and Java was the result of Netscape reaching an agreement with Sun Microsystems for marketing reasons at that time.
It is generally believed that the reason why Netscape named LiveScript JavaScript at that time was because Java was the most popular programming language at the time, and the name "Java" helped the spread of this new language.
The similarities between JavaScript and java:
Their syntax is very similar to the C language;
They are all object-oriented (although the implementation methods are slightly different);
JavaScript is designed with reference to Java’s naming rules;
The difference between JavaScript and java:
JavaScript is a dynamically typed language, while Java is a statically typed language;
JavaScript is weakly typed, and Java is strongly typed;
JavaScript’s object-oriented implementation is based on prototype (prototype-based), and Java is based on classes ( class-based);
In addition to looking more similar to Java, JavaScript has a very different language style. The objects that JavaScript was designed to refer to did not include Java, but included languages like Self and Scheme.
Recommended study: "javascript basic tutorial"
The above is the detailed content of What is the relationship between java and javascript?. For more information, please follow other related articles on the PHP Chinese website!