Method Overriding

A subclass method overrides its superclass method if it has the same name a parameter types as its superclass. Output: 4 sides You can notice the subclass and the superclass…

Continue Reading Method Overriding

Static methods in Java

Why static methods? Take two people (two objects below). The getName method will return the name of the first person, and the second person, but there's something different about calculateAge…

Continue Reading Static methods in Java

Method Overloading

When you give two or more methods the same name within the same class you are overloading the method name. Overloaded methods have something different in their parameter lists. Java…

Continue Reading Method Overloading

toString method

Any time that you need a string representation of an object, we use toString. Outputs: The contructor for this is 5/6/7 Since 'this' is used, in the system.out.printf statement, it…

Continue Reading toString method