150 likes | 258 Vues
This lecture explores the fundamentals of Object-Oriented Programming (OOP) using Java, a prominent language in both industry and academia. We define key concepts such as classes (templates for objects) and objects (instances of classes), along with the benefits of OOP like modularity and information hiding. You'll learn about class diagrams, including UML and OMT diagrams, and understand how to send messages to objects to instruct them. This guide is essential for grasping OOP principles, enhancing your programming skills in Java.
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