Home  >  Article  >  Web Front-end  >  The difference between Javascript and Java

The difference between Javascript and Java

黄舟
黄舟Original
2016-12-14 16:02:051113browse

What is the difference between Javascript and Java? Are you still confused about these two languages? Here is a comparison of the similarities and differences between the two languages:
 Object-based and object-oriented
 Java is a true object-oriented language Languages, even to develop simple programs, must be designed with objects.
 JavaScript is a scripting language that can be used to create complex software that has nothing to do with the Internet and interacts with users. It is an Object Based and Event Driver programming language. Therefore it itself provides a very rich set of internal objects for designers to use.
 Interpretation and Compilation
 The two languages ​​are executed differently in their browsers. 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 compile the code independently of a specific platform through the compiler or interpreter. of bondage.
 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 for interpretation and execution by the browser.
 Strong variables and weak variables
 The variables used in the two languages ​​are different.
 Java uses strong type variable checking, that is, all variables must be declared before compilation. Such as:
 Integer x;
 String y;
 
 Variable declaration in JavaScript adopts its weak type. That is, the variable does not need to be declared before use, but the interpreter checks its data type at runtime, such as:
 Is a character variable.
 The code format is different
 Java is a format that has nothing to do with HTML. It must be loaded like foreign media is quoted in HTML. Its code is saved in a separate document in the form of byte code.
 JavaScript code is a text character format that can be directly embedded in HTML documents and can be loaded dynamically. Writing HTML documents is as easy as editing text files.
  The embedding methods are different
  In the HTML document, the two programming languages ​​​​are identified differently. JavaScript is identified by <Script>...</Script>, while Java is identified by ... Static binding and dynamic binding
 Java uses static binding, that is, Java object references must be made at compile time so that the compiler can implement strong type checking.

For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn