Simple inheritance example
Output: 4 Star 4 Important: The subclass CANNOT access PRIVATE variables and methods of the superclass
Output: 4 Star 4 Important: The subclass CANNOT access PRIVATE variables and methods of the superclass
Static should be applied to: A variable or method that is independent of the specific instance of the class When a method performs a task that is independent of the…
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…
Make constants, like PI, static and public If static variables are not constants, keep them private if possible Static variables save space and are easy to use as they keep…
Output: 1 2 3 4 Static variables as demonstrated above are remembered between states, so when a new object is created, the static variable is remembered, so this allows us…
There are 3 main types of variables: Local Parameter Instance The scope of a variable is the part of the program where the variable can be accessed. It's good programming…
"this" can be used inside any method to refer to the current object "this" is always a reference to the object on which the method was invoked "this" is a…
There are two types of methods in Java: Implicit Parameters & Explicit Parameters Explicit Parameters "int side" in the getArea method is an EXPLICIT parameter. Implicit Parameters str1 is a…
https://www.youtube.com/watch?v=KS8zZ5UQJiU&list=PLonJJ3BVjZW6_q8gh7XoLUIhRIyBcYJLP
Test = name of the class myTest = object reference variable Test() = contractor of test Credit: screen shot from SlideNerd videos on youtube myTest does not actually hold an…