Home>Article>Web Front-end> what is the difference between javascript and java
Difference: 1. JavaScript is based on objects, while Java is object-oriented. 2. Java source code must be compiled before execution, but JavaScript code does not need to be, and can be directly interpreted and executed by the browser. 3. JavaScript is a dynamically typed language; Java is a statically typed language.
The operating environment of this tutorial: windows7 system, ECMAScript 5&&java8 version, Dell G3 computer.
What is JavaScript?
JavaScript is a literal scripting language that is a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .
JavaScript is a network scripting language that has been widely used in Web application development. It is often used to add various dynamic functions to web pages to provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts realize their functions by embedding them in HTML.
What is Java?
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 and easy to use.
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.
The difference between javascript and java
1. JavaScript and Java are different products developed by different companies.
Javascript is a product of Netscape. Its purpose is to extend the functions of Netscape Navigator and develop an object-based and event-driven interpretive language that can be embedded in Web pages;
Java is a new generation of object-oriented programming language launched by SUN Microsystems, which is particularly suitable for Internet application development. In fact, the original name of javascript was not javascript, but LiveScript. The "Java" in the name was authorized by SUN Microsystems.
2. JavaScript is object-based. It is a scripting language and an object- and event-driven programming language. Therefore, it itself provides a very rich set of internal objects for designers to use. Java is object-oriented, that is, Java is a true object-oriented language. Even when developing simple programs, objects must be designed.
3. JavaScript and Java are executed differently in browsers.
Javascript is an interpreted programming language. Its source code does not need to be compiled before being sent to the client for execution. Instead, character codes in text format are sent to the client, that is, the JavaScript statement itself is accompanied by the Web page. It is downloaded and interpreted and executed by the browser.
The Java source code must be compiled before being passed to the client for execution. Therefore, the client must have an emulator or interpreter on the corresponding platform. It can be independent of the compiler or interpreter. Compile code for a specific platform.
4. Java mainly runs on the server side; javascript mainly runs on the client browser.
5. The variables used by javascript and Java are different.
The variable declaration in JavaScript adopts weak type, that is, the variable does not need to be declared before use, but the interpreter checks its data type at runtime. Java uses strong type variable checking, that is, all variables must be declared before compilation.
6. JavaScript uses dynamic binding, that is, JavaScript object references are checked at runtime. Java uses static binding, that is, Java object references must be made at compile time so that the compiler can implement strong type checking.
7. JavaScript does not directly operate text and graphics. It works together with HTML element combinations in Web pages, but it can control the browser and allow the browser to directly process text and graphics. Java can directly operate on text and graphics.
8. Java’s grammatical rules are much stricter than JavaScript’s and its functions are much more powerful.
For more programming related knowledge, please visit:Programming Video! !
The above is the detailed content of what is the difference between javascript and java. For more information, please follow other related articles on the PHP Chinese website!