What's the difference between JavaScript and Java?
While the two share part of their names in common, they are really two completely different programming languages/models/platforms. Yes, they can communicate with each other through technologies like LiveScript. However, you should really consider them as two completely separate technologies.
What this distinction means to web page designers is this: javascripts function much more quickly than java applets.
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 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; 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......... }
Ex : Variables in Java is declared as datatype <varname>; --> int num;
But in Javascript variable declaration will be as var <varname>; --> var myName;