Java vs Javascript Jessi Style Java is an











- Slides: 11

+ Java vs. Javascript Jessi Style

+ Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems n Compiled n Can stand on its own n Written once, run anywhere n Two-stage debugging

+ Five Primary Goals n It should be "simple, object-oriented and familiar” n It should be "robust and secure” n It should be "architecture-neutral and portable” n It should execute with "high performance” n It should be "interpreted, threaded, and dynamic"

+ Syntax n Derived mainly from C++ n Source files must be named after the public class they contain n The compiler will generate a class file for each class defined in the source file n The keyword public denotes that a method can be called from code in other classes n The keyword static indicates that the method is associated only with the class and not with any specific instance of that class. n The keyword void indicates that the main method does not return any value to the caller class Hello. World. App { public static void main(String[] args) { System. out. println("Hello World!"); // Display the string. } }

+ Javascript Java. Script is a scripting language that was created by Netscape, originally known as Live. Script n Most commonly used as part of web browsers n Also being used in server-side programming, game development and the creation of desktop and mobile applications n Supports much of the structured programming syntax from C n Functions are objects, which have properties and methods n Variables can be defined using var

+ Javascript n Interpreted n Must be placed inside an HTML document n Different browsers n Runtime-only debugging

+ Similarities n Object Oriented languages n Both can run in a browser n Both can run on a server n Both are influenced by the programming community n Both have libraries and frameworks

+ Object Oriented Programming n Language model organized around objects rather than actions n Terminologyn Class: Defines the characteristics of the Object n Object: An Instance of a Class n Property: An Object characteristic, such as color n Method: An Object capability, such as walk n Package: a namespace for organizing classes and interfaces in a logical manner n Inheritance: A Class can inherit characteristics from another Class

+ Libraries and Frameworks n Help programmers by providing access to general and purposespecific code that can be reused over and over again for different products Javascript n Struts n j. Query n Tapestry n Prototype n Maverick n Moo. Tools

+ Resources n https: //developer. mozilla. org/en. US/docs/Web/Java. Script/Introduction_to_Object. Oriented_Java. Script n http: //www. seguetech. com/blog/2013/02/15/java-vs-javascript n http: //www. htmlgoodies. com/beyond/javascript/article. php/3470 971 n http: //www. java. com/en/download/faq/java_javascript. xml

+ Questions n What is the difference between compiled and interpreted? n n What is Object Oriented Programming? n n Compiled means the code is changed into bytecode which is not readable by humans and any Java Virtual Machine can run it. Interpreted is executed in the same syntax in which it is written Object-oriented programming is a programming paradigm that represents concepts as "objects" that have data fields (attributes that describe the object) and associated procedures known as methods. How are Java and Javascript similar? n Refer to slide 7