Classes and objects
Objects are just things, like a ball, submarine, or a dog are actual objects. Object-oriented programming like C++ and Java sort all there program in objects.
There are many advantages to program in this way:
Ways we could use objects:
A class is a definition of a object. Just like Java has built in types like String. We can define our own type of variable or object using classes. They are blueprints for objects.
Classes can have fields and methods. Fields store class information, such as Dog's age, color, gender, etc. Methods perform action.
For example: my dog Luna is an example of dog. The idea of a dog is not an actual animal, but just an idea, while Luna is a real example of a dog.
In this case we would define a class Dog and Luna would be an instance of dog.
Lets make this happen in BlueJ. Create a class Dog that will keep track of all these things and have these methods.
Lets create a class Kennel that will create instances of 2 dogs.