reference or pointer in object Object-Oriented Programming (OOP) Example in Java

(爛尾了,不刪了,給個紀念,哈哈)

Reference or pointer is a very important concept in object-oriented programming. Reference and pointer are kinds of the same concept just with different names. The following discussion will begin with a single line of code.

1
Human daniel = new Human();

related post: Four Core Features of Object-Oriented Programming

Object-Oriented Programming (OOP)

Object-Oriented programming is a new approach to programming. Instead of giving a set of actions to a program (procedural programming), we use objects to be the building block of the whole program.

More info: Deployment

Example in Java

The following statement is an example of how you create an object in java.

1
Human daniel = new Human();

To create a new object in java, it involves the use of the keyword new to allocate the memory space of the object and the use of the object’s constructor, Human() in this case, to initialize the space.