Thursday, 21 November 2013

what is difference between java and javascript ?

Java and JavaScript are completely different, and are related only by the inclusion of "Java" in the name.
The inclusion of the "Java" name in "JavaScript" was the result of a co-marketing arrangement between Netscape and Sun Microsystems back when Netscape was a dominant web browser, in exchange for Netscape bundling Java Runtime Environment (JRE) with its browser.

*Java is an Object Oriented Programming (OOP) language while Java Script is an OOP scripting language that was created by the fine people at Netscape and was originally known as LiveScript..

*Java creates applications that run in a virtual machine or browser while JavaScript code is run on a browser only as firefox, chrome etc.

*Java code needs to be compiled while JavaScript code are all in text.

*Java is a statically typed language; JavaScript is dynamic.

*Java is class-based; JavaScript is prototype-based.

*Java constructors are special functions that can only be called at object creation; JavaScript "constructors" are just standard functions.

*Java requires all non-block statements to end with a semicolon; JavaScript inserts semicolons at the ends of certain lines.

*Java uses block-based scoping; JavaScript uses function-based scoping.

*JavaScript is a scripting language that runs inside of an Internet browser to manipulate and enhance the contents of Web pages.

*Javascript is used for front-end web development while Java can only be used as a back-end language within a web environment.

*JavaScript  is a lightweight programming language.

*Java  -

One of the major differences between Java and JavaScript is that Java is a compiled, high-level, multi-purpose programming language, which can be used for a wide variety of different tasks, both online and in a browser and offline and running on a computer’s operating system, independent of whether or not the computer has an Internet connection.

Unlike JavaScript, which can be written and then immediately executed with a user’s browser, after writing Java code, it must first be compiled, or turned into code that can be understood by the computer, or more specifically, the Java Runtime Environment’s, or JRE’s, virtual machine (JVM), since Java code runs with the help of a virtual machine.


JavaScript is "a scripting language”, and it is mainly used in web development, as it allows programmers to add more interactivity and functionality to webpages than just HTML and CSS alone. JavaScript is also frequently used with languages like PHP and MySQL, in the form of AJAX or by use of the jQuery library.

To be more specific, JavaScript is considered a “client side scripting language”, which means, unlike languages, such as PHP, which is a “server side scripting language”, it can be used to interact with a user’s web-browser, adding interactivity that otherwise would not be present with just HTML or PHP alone.