X



Home>Tutorial>

Top 10 differences between Java and JavaScript

Nuelson Penuel Monday, September 21, 2020 Javascript

Java and Javascript

It is no rumor that most programmers mostly beginners usually think that Java and Javascript is the same language but have two different names. Today, am here to enlighten you on the differences between Java and Javascript. Java and Javascript are two different languages entirely though they have similar features. In other words, is the right time for you to clear your doubt i.e Java language and Javascript language are not similar languages, and Javascript is far far different from the Java programming language.

Difference Between Java and Javascript

Java Language JavaScript Language 1. Java is a programming language. While Javascript is a scripting language. 2. Java is a pure Object Oriented Programming Language. While JavaScript is Object-Based Language. 3. Java is a Standalone language. But JavaScript is not a standalone language, as it needs to be integrated into an HTML program for execution. 4. Java is a strongly typed language, which means that the user has to decide the data type of the variable before declaring and using it. Example "int a", the variable "a" can store the value of integer type only. While JavaScript is a loosely typed language, which means that the user does not have to worry about the data-type of the variable before and after the declaration. Example "var a", the "a" variable can store the value of any data-type. 5. Java program should be compiled before execution. JavaScript needs to be integrated into the HTML program for the execution. 6. Java does not require web browser to run its programs. While Javascript require web browser to run its programs. 8. In Java, by utilizing the Multi-threading, users can perform complicated tasks. In JavaScript, user is not able to perform complicated tasks. 9. Java requires a large amount of memory. While Javascript does not require huge amount of memory. 10. Java programming language was developed by the "Sun Microsystems." JavaScript programming language was developed by the "Netscape." Let us see how programs are written in both the languages. In Java, to print string on screen, you make use of system.out.println("Expression") while in Javascript, you use document.write("Expression") Program to print "Hello World" in Java

class JavaHello  
 {   
public static void main(String args[]){   
    System.out.println("Hello World");   
 }   
}  
Output Hello World Program to print "Hello World" in JavaScript

<!DOCTYPE html>  
<html>  
<head>
<title>JavaScript Hello World Tutorial</title>
<script>  
document.write("Hello World!");    
</script>  
</head>
<body>  

</body>  
</html>  
Output
Hello World!
That is all. Thanks for reading.

| | Views(446)

See Demo | Download File


Add your comment. Indicate code using code tag


Words: 0 | Chars: 0 | Reading Duration: 0



Images Attachment




Emmason Integratded Services(2017-2024)
All Rights Reserved
Designed and Maintained By Emmason Integrated Services