Java and JavaScript look so much alike, are they the same thing? Now let me reveal the answer!
JavaScript is an embedded script file that is inserted directly into a Web page and is executed by the browser while interpreting it.
The Java language is not the same, he must be running on a Java virtual machine. And it needs to be compiled beforehand.
Java's syntax rules are much stricter than JavaScript, and the functionality is much more powerful.
First of all, the two guys were not in any relationship, Java was launched in May 1995 by Sun, and JavaScript was designed by Netscape in 1995, because of Netscape's collaboration with Sun, The top Netscape wants it to look like Java, so it's named JavaScript.
Second, the nature of the two guys is different, Java is an object-oriented programming language that can compose cross-platform applications, and you must design objects even if you are developing simple programs, and JavaScript is a literal-translation scripting language that itself provides a very rich internal object for designers to use.
And they are executed differently, Java is a language between the interpretation and the compiled language, Java source code in the delivery to the client before the implementation, must be compiled, through the corresponding platform of the interpreter, to achieve independent of a particular platform to compile code constraints. JavaScript is an interpretative programming language whose source code does not need to be compiled before it is sent to a client, but instead sends a text-formatted character code to the client for interpretation by the browser.
Second, the use of the two is also different, Java is widely used in personal PCs, data centers, game consoles, science supercomputers, mobile phones and the Internet, and the use of JavaScript is: 1. Embed dynamic text in HTML page; 2. respond to browser events; 3. Read and write HTML elements; 4. Verify the data before the data is committed to the server; 5. Detect visitor's browser information; 6. Control cookies, including creation and modification.
The above is a small set of JavaScript and Java to introduce the difference between the introduction, learn Java how, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!