What is the difference between java and javascript

What is the difference between java and javascript


Many people think that JavaScript is a part of Java, but this is not true. Java and JavaScript are similar like Car and Carpet are similar. Below I have shared some key differences between them.

Java vs. JavaScript – Difference between Java and JavaScript

S. No.

Java

JavaScript

1.Developed ByJava was developed by James Gosling at Sun Microsystems.Developed ByJavaScript was developed by Brendan Eich at Netscape Communications Corporation.
2.Object Oriented Programming LanguageJava is a true Object Oriented Programming Language as it requires everything to be a part of a Class and thereby, Objects.Object Oriented Scripting LanguageJavaScript is also an Object Oriented Language but it is a Scripting language which makes it different from Java.
3.Application and AppletJava is usually used for standalone application software development as well as web applet development.Web DevelopmentJavaScript is normally embedded into HTML code. It is primarily and only used for web development purposes.
4.Java is class-based Programming LanguageEvery single line of code in Java requires it to be inside a Class (thereafter Objects) which makes it a complete Class based programming language.JavaScript is Prototype-based Scripting LanguageIt is a kind of Object Oriented Paradigm in which Inheritance i.e., behavior reuse is performed via a process of cloning (duplicating) existing Objects that act as prototypes.
5.Java is a Statically Typed Programming LanguageJava uses static typing. It is a process in which type checking is performed during compile-time. Hence, Java is said to be a statically typed programming languageJavaScript is a Dynamic Typed Scripting LanguageJavaScript uses dynamic typing. It is a process in which type checking is performed during run-time. Hence, JavaScript is said to be a dynamic typed scripting language.
6.Applications of JavaJava language can help us to create standalone application software that can be executed on the desktop environments such as on Windows, Mac, Linux. It can also help us to build Applets that can be embedded into HTML.Applications of JavaScriptJavaScript cannot be used to create Applets or standalone applications. JavaScript resides inside HTML documents, and provides excellent interactivity features to web pages that are not achievable with HTML and CSS.
7.Inter-DependenceJava Applet runs on the web browsers, independent of the HTML or any other scripting language used to design that particular web page.Inter-DependenceJavaScript is dependent upon the HTML code as it always has to be embedded into it. It can run only on web browsers.
8.ExecutionJava programming language is a compiled language. Hence, it needs to be converted into a fresh machine code file on different operating system.ExecutionJavaScript doesn’t need to be compiled. All of its code is text based. Therefore, it supports almost all the platforms as it has to be executed within a web browser.
9.Scope for ModificationsOnce a Java Applet or a standalone application is developed after compilation, it cannot be modified. If you want to modify it, you will need to get it done by editing the source code and then re-compiling the complete file.Scope for ModificationsJavaScript code can be altered/modified as many times you want without the issue of compilation or interpretation. You just modify it and it will directly update the new code.

Comments