Wednesday, 4 July 2012


What are the differences between java and JavaScript?


Answer:
There's a world of difference between the two. Javascript is used for front-end web development while Java can only be used as a back-end language within a web environment. Java doesn't need a web browser to compile and execute like Javascript does. Java is compiled prior to runtime while Javascript is compiled at runtime. The syntax/reserved-words are also different. There's many more differences if you go and do some research on the two languages. 


Following are some points which differentiates java & javascript 

  1. Java follows strong type checking where as Javascript is very flexible in datatype(loosly typed). Supports types which represents boolean,int,string 
    • Ex : Variables in Java is declared as datatype <varname>; --> int num; 
    • But in Javascript variable declaration will be as var <varname>; --> var myName;
  2. Javascript support function declarations, but without accessibility specifiers,parameter datatype,return type
  • Javascript : function fcnName(str)
{ 
........function body.......... 
} 

  • Java : public int functionName(int no)
{ 
..........function body......... 
} 




will continue with answer...........
Java is a programming language designed to run in a Java Virtual Machine which is itself a program that allows java programs to run on any computer/device a Java Virtual Machine has been programmed for. 

Java script is a scripting language that runs inside of a internet browser to enhance the web experience. Java script is designed to expand the capabilities of a web page so that it behaves more like a program on the computer than just a static page of text and images.

No comments: