Difference between Java and JavaScript
JavaScript is a lightweight programming language(“scripting language”) and used to make web pages interactive. It can insert dynamic text into HTML.JavaScript is also known as browser’s language.
JavaScript(JS) is not similar or related to Java. Both the languages have a C like a syntax and are widely used in client-side Web applications, but there are few similarities only.
Java is an object-oriented programming language and have virtual machine platform that allows you to create compiled programs that run on nearly every platform. Java promised, “Write Once, Run Anywhere”.
Here are few differences :-
| Java | JavaScript |
|---|---|
| Java is strongly typed language and variable must be declare first to use in program.In Java the type of a variable is checked at compile-time. | JavaScript is weakly typed language and have more relaxed syntax and rules. |
| Java is an object oriented programming language. | JavaScript is an object based scripting language. |
| Java applications can run in any virtual machine(JVM) or browser. | JavaScript code run on browser only as JavaScript is developed for browser only. |
| Objects of Java are class based even we can’t make any program in java without creating a class. | JavaScript Objects are prototype based. |
| Java program has file extension “.Java” and translates source code into bytecodes which is executed by JVM(Java Virtual Machine). | JavaScript file has file extension “.js” and it is interpreted but not compiled,every browser has the Javascript interpreter to execute JS code. |
| Java is a Standalone language. | contained within a web page and integrates with its HTML content. |
| Java program uses more memory. | JavaScript requires less memory therefore it is used in web pages. |
| Java has a thread based approach to concurrency. | Javascript has event based approach to concurrency. |
Recommended Posts:
- Difference between var and let in JavaScript
- Difference between JavaScript and Php
- Difference between TypeScript and JavaScript
- Difference between == and === operator in JavaScript
- Difference between != and !== operator in JavaScript
- Difference between DOM parentNode and parentElement in JavaScript
- What is the difference between children and childNodes in JavaScript?
- Difference between stopPropagation vs stopImmediatePropagation in JavaScript
- What is the difference between call and apply in JavaScript?
- Compute the set difference using JavaScript arrays
- Difference between substr() and substring() in JavaScript
- Difference between function expression vs declaration in JavaScript
- JavaScript | Difference between String.slice and String.substring
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Difference between x++ and x=x+1 in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : pp_pankaj



