Welcome
1. Welcome
Hi, and welcome to this course on object-oriented programming in Java. My name is Sani Yusuf, and I will be your instructor.2. My experience with Java
I am a lead content developer here at DataCamp, and I have worked with the Java programming language since 2010, using it to write algorithms and build mobile applications. This course has been created in collaboration with Miller Archury, a big-tech senior software engineer.3. Topics covered
Throughout this course, we will discuss different topics related to object-oriented programming and how Java implements these concepts. Object-oriented programming has a reputation for being difficult to grasp, with concepts like polymorphism giving programmers sleepless nights, but this perception will ease as we learn together.4. What is object oriented programming (OOP)
To begin with, let's understand object-oriented programming (OOP). OOP is a programming paradigm that models code based on objects and real-world items. Do not worry too much about this definition of OOP now; it will gradually make more sense as we learn further concepts in this course.5. What is a class?
The first concept central to OOP is the Class. To better understand classes, consider a real-world example using a cookie cutter. If we want to create star-shaped cookies, we will create a cookie cutter in the shape of a star to create cookies that follow its specific shape. The cookie cutter is precisely how you should think of a class. A class is a blueprint of programming code that defines how the program will behave.6. Structure of a class
The basic outline of a class includes the keyword class alongside the class name, ending with a set of curly braces. Anyone we give our Class will be able to create the same code, similar to how anyone we give the star-shaped cookie cutter will create cookies of the same shape. We can create as many cookies as we want of the same shape; however, each cookie we create is a separate cookie, in this case, an independent object. This idea of each cookie illustrates the nature of objects, objects are independent items we create using a class.7. Naming object instance
We use the new keyword in Java to create new objects. Each object we create using the new keyword is called an instance. To create a new object instance, we first write the class name alongside a unique variable name for our instance. Secondly, we use the equal symbol to signify that we want to assign it to a new instance, and then, finally, we use the new keyword alongside the class name to finish. After the new keyword, the class name must always have a pair of brackets signifying that we are creating a new independent class instance.8. Let's practice!
We have learned about classes and objects. Next, you will define and create instances of your classes. Let's get started.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.