Objects Notes

What are Objects?

  • Reference type
  • Instances of a class, which is a blueprint of an object

Creating Objects

  • Declaration: Object is declared as a variable
  • Instantiation: 'new' keyword used to create the object
  • Initialization: giving initial properties to the created object in the constructor
    Painter myPainter = new Painter();

Void Method

  • Do not return a value
  • Can change characteristics of an object, or print text to console

Non-Void Method

  • There is a return type
public int countPaint() {}

String Objects

  • A string is an object, and can be acted upon by methods