Basics of Object Oriented Programming (OOP) in Java

Tim Short
A free video tutorial from Tim Short
Dev / Train / Recuit
4.2 instructor rating • 4 courses • 138,779 students

Learn more from the full course

Become a Junior Java Software Developer

Complete practical and conceptual Java programming course for beginners

07:45:34 of on-demand video • Updated August 2017

  • Be comfortable with writing and designing Java applications
  • Apply core concepts of object-oriented programming to a project
  • Build holistic, real-world practical applications from the ground up
  • Write common algorithms covered in computer science courses
  • Talk confidently about Java programming and object-oriented programming
  • Network with recruiters, hiring managers, and tech professionals
  • Walk into your first job interview and code review with confidence
  • Invitation to participate in internship through SDET University!
English [Auto] All right let's get started talking about object oriented programming. So the first video is just some high level ideas. We can spend a lot of time talking about it but let's just get started with some basic ideas. So some size about how Java got started that we're going to talk about that you can go through some of this on your own time. The different versions of Java started in 95. The latest one that we're using is Java 8. By the time this video comes out and you're doing this we're probably doing one 1.9 Object Orange programming or programming general split into two categories right. There's structural or it's called procedural programming and these are based on functions and so functions were introduced to cope with the reusability of code. Right. If you read the same line of code over and over again you could write a function that could call that same code and then just call the function. So that was a in the hands meant that was a that was progress in the programming world. It thinks further when you talk about object oriented programming and these are more heavier concepts so Java C-Sharp is more object oriented programming. What do we mean by object oriented programming. So the basic concept is you write classes from which objects can be created objects have properties state and behavior. And with this idea we have four common are four core principles are our people call these the four pillars of object oriented programming so this is a very typical interview question so you should be able to talk about one of the principles of object oriented programming for abstraction. Abstraction is the ability for the client to access only the specific desired properties. So if you have a a computer for example a computer is an object think of. Think of it this way and as a user you all all you want to do is turn the power on or off. So there's a way you can do that. The engineers created this object in such a way that you don't need everything exposed to you you don't need to see everything. All you need to do is see the on off button that's all the action you want to do on that computer. So the idea is called abstraction. There are things we can do ways we can interact with the objects and the developer has developed the object in such a way that the user can interact with that object very simply and with whatever whoever they want to interact with that object encapsulation is the idea of binding methods and properties together while hiding complex inner workings. So where we get data hiding so objects in it contain properties and all. As developers we we hide those properties from the clients that make them available through the through properties or through methods and functions and so again this is kind of abstract but we'll see we'll see this implemented as we go on. But I want to talk about the high level view so that when we get into it you have a context or a framework for that for some of these ideas. So encapsulation is good data hiding where methods and properties are bound together again through through through methods. We also have inheritance in some ways inheritance all these kind of play a role and how they are core. So inheritance are you have classes you have chaulk classes and parent classes. So the most parent class in Java would be the object class and all objects are from the Object class and so we can create objects that will inherit properties from the parent class. And so node properties are passed down to child classes and child objects. And then last we applied morphism play morphism is poly many many more more meaning. Shape or form is ability for methods and objects objects to take on various forums for the sake of reasonability and convenience so that what might be the most kind of abstract for you oftentimes play morphism takes some time for people to kind of get their hands on the other three are pretty simple to see and to implement. But these are the four core principles of object oriented programming. You should definitely be familiar with what the terms are a brief definition. Then of course our course is going to go through each of these examples or each of these topics and examples and explain it further.