Okay everyone,
I have been observing lately that students call JavaScript as “Java”. Java is an Object Oriented Programming language, developed at Sun Microsystems in 1995. It is a very popular programming language, used in embedded devices, such as bluray disc players. Whereas JavaScript is developed by Netscape (I think) for running scripts in websites. In contrast to Java’s object oriented nature, JavaScript is a scripting language.
Now let me show you examples of programs in Java and JavaScript to clear out the confusion among students:
Java:
“`
class Main
{
public static void main(String args[]) {
System.out.println(“Hello, World!”);
}
}
“`
JavaScript:
“`
document.write(“Hello, World!”);
“`
As far as these programming languages are concerned, they do indeed have very similar syntax. For example, both languages use curly braces and both use semicolon as a terminator. But when it comes to programming, there is a vast difference.
Java: “`int a = 5;“`
JavaScript: “`a = 5;“`
In Java, we mention the keyword “`int“`. This specifies that the value we are assigning is an integer. In JavaScript, there is no concept of types.
So please, *DO NOT MIX JAVA AND JAVASCRIPT. THEY ARE TWO SEPARATE LANGUAGES, WITH VASTLY DIFFERENT DESIGN CHOICES.*
Your understanding in this matter is highly appreciated.
Thank you.