150 likes | 253 Views
Object Oriented Programmimng. Lec 3. introduction. Java is a new object-oriented language that is receiving wide attention from both industry and academia .
E N D
Object Oriented Programmimng • Lec 3
introduction • Java is a new object-oriented language that is receiving wide attention from both industry and academia. • Java is often described as a Web programming language because of its use in writing programs called applets that run within a Web browser.
Classes and Objects • an object is a thing, both tangible and intangible, that we can imagine. • Ex. For a program to keep track of student residents of a college dormitory • A class is a kind of mold or template that dictates what objects can and cannot do. An object is called an instance of a class.
Benefits of objects • Modularity • Information hiding(API) • Class diagrams • 1.Doughnut diagrams • 2. Object Modeling Technique(OMT) diagrams • 3. Unified Modeling Language (UML) diagrams
Messages • To instruct a class or an object to perform a task, we send a message to it. For example, we send a message deposit to an Account object to deposit $100. • For a class or an object to process the message it receives, it must possess a matching method, which is a sequence of instructions that a class or an object follows to perform a task
A value we pass to an object is called an argument of a message.
A method defined for a class is called a class method, and a method defined for an object is an instance method