What is the difference between Java and JavaScript?
Dustin Durham
4 replies
Replies
Bogomil Shopov - Бого@bogomep
Threat Modeling e-book
Not to be an ** here, but use your favorite search engine and look for an answer. It's not an easy question to answer in just a few of lines :)
Share
Wion - Audio Dating
JavaScript is a “scripting language” used to make web pages interactive. It can insert dynamic text into HTML. JavaScript is also known as a browser's language.
Java is an OOP (object-oriented programming) language. Programs or applications developed in Java will execute in a JVM (Java virtual machine) by which you can run the same program on multiple platforms and systems.
Let’s compare some of its main features:
Java is a strongly typed language where the type of a variable is checked at compile-time. JavaScript is a weakly typed language that has more relaxed syntax and rules;
Java is an object-oriented programming language. JavaScript is an object-based scripting language;
Java applications can be run on any virtual machine. JavaScript code is run on a browser only;
Objects of Java are class-based. JavaScript Objects are prototype-based;
Java programs use more memory. JavaScript requires less memory, therefore, it is used in web pages;
Java language syntax is similar to C/C++ programming language. Java programs will be in classes and objects. JavaScript language syntax is similar to C language but naming conventions are similar to Java programming language.
As we can see JavaScript is not similar or related to Java. Both languages have a C-like syntax and are widely used in client-side web applications, but there are few similarities only.
Java is an Object-Oriented programming language, while JavaScript is an Object-Oriented Script language. Java creates applications, while JavaScript code runs on browsers only.