Classes and Objects
The course is part of this learning path
This course looks at Object-Oriented programming in Java and shows how classes are designed and constructed, and how objects are created from them. Then, we'll complete three projects: creating a bank account class, an ice cream class, and a circle class, as well as tests to make sure that they work in order to reinforce what you've learned.
- Beginner coders or anyone new to Java
- Experienced Java programmers who want to maintain their Java knowledge
- Developers looking to upskill for a project or career change
- College students and anyone else studying Java
This is a beginner-level course and can be taken by anyone with an interest in learning about Java.
This lecture is going to focus mostly on some fundamental terms and theory. But theory helps us to be better practitioners, better developers. So, don't skip this lecture. There are many different so called programming paradigms which are simply classifications that we use to describe different programming languages. One of the earlier, extremely popular programming paradigms was procedural programming, which focuses on the procedures which are, specifically in our case, methods, that can perform tasks for us.
We have used procedural programming techniques a lot in this course. We have focused on solving problems by breaking them down into more manageable pieces that can be solved by using methods that we write. The data that we work with is not very strongly associated or coupled with the methods that we use to operate on the data. A more modern, very popular paradigm that grew out of procedural paradigm is the object-oriented paradigm. Instead of focusing mostly on the procedures or methods in our case, we focus on objects.
An object represents some entity that has both behaviors and data. The behaviors are procedures or operations that the object exposes to perform tasks. The data and the behaviors live together in the object; a feature we call encapsulation. In fact, encapsulation is one of the three primary principles of object-oriented programming, also called OOP. You should memorize the names of all three even though we don't fully understand them right now. We will discuss each of them in more detail throughout the course. The three primary principles of OOP are encapsulation, inheritance, and polymorphism. You should learn them in that order as well. It helps to understand encapsulation before inheritance and polymorphism doesn't make much sense without inheritance. So, understanding inheritance is particularly important for understanding polymorphism.
Before we move on, since we haven't learned the related syntax yet, our challenge is based on what you learned in this lecture. So, I'm going to pause for a few seconds after I ask you a couple questions. What does OOP stand for? And what are the three primary principles of OOP? So, pause the video and try to answer these two questions. Do you remember the information related to the questions I asked? OOP stands for object-oriented programming. And the three primary principles of OOP are encapsulation, inheritance, and polymorphism. The remainder of this section aims to help us understand the fundamentals of classes and objects with a specific focus on encapsulation. We will cover inheritance and polymorphism in a later section in this course in much more detail. Let's get going with encapsulation up next. I'll see you there.
John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.