Java Tutorial · Revision notes

Java OOPs Basics

Object-Oriented Programming organises code into classes and objects that combine data and behaviour. This chapter covers the OOP concepts, classes and objects, constructors, the this keyword, the static keyword and method overloading with full programs.

Quick revision

  • OOP pillars: abstraction, encapsulation, inheritance, polymorphism.
  • Class = blueprint; object = instance created with new on the heap; reference holds its address.
  • Constructor: same name as class, no return type, runs on new; default one is added only if none is written.
  • this = current object: field access, this(), pass/return this.
  • static members belong to the class, are loaded once and cannot use this.
  • Static block runs once at class loading; instance block runs on every new.
  • Overloading = same name, different parameters, decided at compile time.
  • Resolution order: exact, widening, boxing, varargs.
Read the full Java OOPs Basics notes on Doubtclip →