Lecture 1: An Introduction to Java. What is Java? Programming language developed by Sun Microsystems in 1995 –Inherits its syntax from c –Adapted the.
Published byModified over 6 years ago
Presentation on theme: "Lecture 1: An Introduction to Java. What is Java? Programming language developed by Sun Microsystems in 1995 –Inherits its syntax from c –Adapted the."— Presentation transcript:
What is Java? Programming language developed by Sun Microsystems in 1995 –Inherits its syntax from c –Adapted the object model from C++ Object Oriented Language Compiled and Interpreted Both WWW (applet) and stand alone (Application)
Birth and Growth of Java Invented by James Gosling in 1995 – originally not intended as a new language Originally intended for writing programs that control consumer appliances such as toasters and microwave ovens. Sun commissioned by Time-Warner to develop language Time Warner lost patience with delays –Sun lost contract –Sun gained new language Fundamental concept: Write once – Run Anywhere (write on one O/S run on any)
Object Orientation Object Oriented (oo) philosophy operates by modeling real world entities within a computer program. This involves using different characteristics for objects. Objects then interact by passing messages Object oriented design –A software design method that models the characteristics of abstract or real objects using classes and objects
Objects and Classes Object An object is a combination of some data (variables) and some actions (methods) Objects are the principal building blocks of object oriented programs. Each object is a programming unit consisting of data (instance variables) and functionality (instance methods) Class A template or type describing the fields and methods that we group together to represent something
Objects and Classes A class is a generalisation of an object – it is the blueprint from which instances of objects can be created. Once a class is designed, many objects can be constructed with the same behaviour Example: Student Students have certain characterisitics that distinguish them from each other…… Name University Course Age Gender
Objects and Classes An object is something you can use A class is a description of how to create an object Objects are ‘real’ classes are not.
Class (Template) Name University Course Age Gender Marie Trinity History 21 Female Frank Ucc BIS 20 Male
Student Example Marie and Frank are two instances of a student They have the same general information but can be differentiated by the specific values assigned to them We can pass messages to each student object to find out their characteristics: What is your name?(frank) What is your course?(BIS)