What is the difference between Java and Javascript?

Java is an object-oriented programming language. It has a virtual machine platform that allows users to create compiled programs that run on almost every platform. Java is a "Write Once, Run Anywhere" programming language.

JavaScript is a lightweight scripting language and is used to make interactive web pages. JavaScript runs only on web browsers. JavaScript is not similar to Java.

  • Java is an object-oriented programming language.
  • Objects in Java are class-based and we cannot any program in java without creating a class.
  • Java applications can run on any virtual machine.
  • Java program has the file extension ".java" and translates the source code into bytecodes which are executed by JVM.
  • Java program uses more memory.
  • It is one of the complex languages to learn.
  • Java has a thread-based approach to concurrency.
  • Java program should be compiled before execution.
  • Java programming language was developed by "Sun Microsystems."
  • Java is stored on the host machine as the "Byte" code.
  • Java is strongly typed and requires all variables to have a declared type.
  • Java allows a class to derive the properties of another class.
  • Java is a stand-alone language.
  • A sample code snippet of Java is given below.
import java.util.Scanner;
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("This is Java Program");
  • JavaScript is a scripting language.
  • Objects in JavaScript are prototype-based.
  • JavaScript languages run only on the browser.
  • JavaScript file has the file extension ".js" and it is interpreted but not compiled, every browser has the Javascript interpreter to execute JS code.
  • JavaScript program uses less memory.
  • JavaScript is one of the easiest languages to learn.
  • Javascript has an event-based approach to concurrency.
  • JavaScript needs to be integrated into the HTML program for execution.
  • JavaScript programming language was developed by "Netscape."
  • JavaScript is stored on the Host machine (client Machine) as the "source" text.
  • JavaScript is weakly typed and doesn’t require definitions for all variables.
  • JS is based on the concept of prototypes and does not support the concept of inheritance.
  • JavaScript is not a standalone language, it needs to be integrated into an HTML program for execution.
  • Sample code snippet of JavaScript is given below
var textsize = 5;
var myWait = setInterval(GrowText, 100);
function GrowText() {
  if (textsize < 51) {
    textsize = textsize + 1;
    document.getElementById("myP1").innerHTML = "Growing Text"
   } else {
    myWait = setInterval(ShrinkText, 100);
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions