Skip to content

Commit cef537f

Browse files
authored
Update README.md
1 parent 74d82dd commit cef537f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Classes/README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,20 @@ Person x = new Person();
1717
### x is what’s called an identifier
1818

1919
### A Class is a structure/blue print and object is an instance of the class. The above has a class name Person. Person here, is what's called a custom type
20-
### x is the identifier. When we instantiate we can create n number of objects say: Alan, Waleed, Neha, Michael, Juan
20+
### x is the identifier. When we instantiate we can create n number of objects say: Alan, Waleed, Neha, Michael, Juan. These are all instances which are different
21+
### from static methods. A static method is attached to a class rather than an instance of a class / an object. When wanting to use a static method of the class
22+
### unlike an instance method, it has to declare an instance of the class in order for it to use the instance method. A static method can use the he method as soon
23+
### as it wants. We create instances of the class which create us branches. These branches are referred to as objects. Anytime we create a method within the class.
24+
### we create an instance of the class, the method we created is made available for use to us. An instance method is the complete opposite of a static method. An
25+
### instance method is attached to the instances.
26+
27+
Say I do this
28+
Animal bear = new Animal();
29+
bear.talk();
30+
31+
32+
A static method on the other hand is attached to the class unlike an instance method we do not have to use the class instance to use the instance method. We can do it directly on the class.
33+
2134

2235

2336
### A field is just a variable within a class

0 commit comments

Comments
 (0)