Please enable JavaScript.
Coggle requires JavaScript to display documents.
C1 : Inheritance and Polymorphism (Basic Syntax (Case sensitvity, Class…
C1 : Inheritance and Polymorphism
Terms
Object
Have state and behaviours
Class
A template/blueprint in creating and defining this state and behaviour
Method
A behaviour
Where logic is written and data is manipulated
Instance Variables
each object had unique set of instance variables
Object state is defined by the values assigned to this instance variables
Basic Syntax
Case sensitvity
Class name
Method name
Program file name
psvm
Identifiers
Should begin with
a-z, A-Z, $, _
cannot space
keyword cannot be use
case sensitive
Modifiers
Access modifiers
public
protected
default
private
Non-access modifier
final
abstract
stricfp
Variables
Local variables
Inside constructor, method, or blocks
Class variables
Static variables
Inside class, outside method
Instance variables
Non-static variables
Inside class, outside method
Array
Object that store multiples variables of the same types
Inheritance
Reuse code
Interface
A contract between object on how to communicate with each others
Define method that subclass should have
Creating a class
Variable declaration
Instantiation
new keyword used to create new object
Initialization