DEV Community

Ajay Neman
Ajay Neman

Posted on

Java Vs JavaScript

Without wasting your valuable time, let's directly head over on the difference.

No. Java JavaScript
1. it is both compiled and interpreted language it is compiled language
2. It is OOP programming language It is OOP scripting language
3. It can runs on virtual machine as well as on browser also it can only runs on browser
4. It is class based language and it cannot run without class It is prototype based language
5. It is standalone language which is executed by the JVM (java virtual machine) that's need to be compilde into "byte code" It is not a standalone language. It Must be placed inside an HTML document to function and executed by the web browser
6. It has the file extension as .java It has the file extension as .js
7. It s strongly typed language means when we declare any variable we need to specified the data type. eg. int a; here 'a' will only store integer value. It is loosely typed language means we need not have to specified the data type instead we need to write either var or let or const keyword.
8. source code in this is hidden as it is compiled into the unreadable byte code. The source code can be read by any person as it is written in plain text.
9. Java is developed by keeping "security of code" as the primary motive that can be achieved through JVM. JavaScript is less secured and you have to make efforts to secure it's coding from the cross-site scripting. etc.
10. Java is mostly used in android development, backend web development and to create standalone application. JavaScript is used in frontend as well as in back end web development.

Thank You for reading :>

Top comments (2)

mindninjax profile image
Rishabh Singh ⚡

Very informative bro... No if I ever came across someone comfused between the two, I am gonna share this blog with them...

nemanajay profile image
Ajay Neman

Thanks bro😊