+ 2

What is the difference between Java and JavaScript?

They have similar names. Is their syntax same? What is their function? What are they commonly used for? What is their purpose? I want a short and sweet answer.

9th Apr 2017, 6:28 AM
Ayudh Khajne
Ayudh Khajne - avatar
3 Answers
+ 4
They have similar names but their syntax is actually different. Java is actually an object-oriented programming language while JavaScript is more of a scripting language. Java can stand on its own and JavaScript pretty much needs to be placed inside HTML document to run. Java is a language that can create the so-called "standalone" applications like Java applet while JavaScript is run in a browser that can interpret it and then it is enacted by the browser. Java language must be compiled into a machine language before it can be run on the Web. What happens is that the code would be compiled into a lower-level language that the computer can understand before the computer runs your code. If you want to change the content of it, you basically have to recompile again. JavaScript is more of text-based. You write it to an HTML document and it is run through a browser. You can alter it whenever you want.
9th Apr 2017, 6:40 AM
Deddy Tandean
9th Apr 2017, 6:36 AM
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender)
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender) - avatar
0
JavaScript scripting language, Java is a programming language. They're not related. Java is mostly used in enterprise softwares whereas JavaScript is essential to WebDev. You'd be comparing apples and oranges if you want to compare the two. Sure they're both fruits, but they're very different.
9th Apr 2017, 8:57 AM
Toni He
Toni He - avatar