Wednesday, June 20, 2018

Differences Between Java and JavaScript

In this post you will learn the main differences between Java and JavaScript.Programmers, developers and internet users have always been confused between Java and JavaScript. Many people still thinks that JavaScript is part of Java platform, which is not true. In truth, JavaScript has nothing to do with Java, only common thing between them is word "Java",

JavaScript is a client side scripting language for HTML, developed by Netscape, Inc, while Java is a programming language, developed by Sun Micro System.

Java is an OOP programming language,It is  used for creating desktop applications or others. To compile java based programs you need JDK+JRE set up in your computer. Since java is pure object oriented programming language everything you do is under a class.

JavaScript is a client side scripting programming language. You don't need anything except a browser for running a script. In JavaScript everything is objects/functions. There is no concept of classes.



One more difference which comes form this fact is that, Java is run inside JVM and needs JDK or JRE for running, on there other hand JavaScript runs inside browser and almost every modern browser supports JavaScript.

Java uses static type checking, where the type of a variable is checked at compile-time. The programmer must specify the type (integer, double, string, etc.) of any variable they create. JavaScript, like most scripting languages, uses dynamic typing, where type safety is verified at runtime.

JavaScript is much more forgiving than Java, you don't have NullPointerException in JavaScript, your variable can accept different kinds of data because of JavaScript is dynamically typed language.

Objects of Java are class based.

Objects of JavaScript are prototype based.

Java has block based scope.

JavaScript has function based scope and object based context.






No comments:

Post a Comment

High Paying Jobs after Learning Python

Everyone knows Python is one of the most demand Programming Language. It is a computer programming language to build web applications and sc...