If you want to initialize a variable before you make an object, all you have to do is make a method, name it the exact same thing as your class… instead of leaving parameters empty, just put argument in there (“”), and your constructor will do the rest.

A constructor allow you to initialize variables as soon as objects are made.

If you have a if-else statement inside another if-else statement, that is called nesting.

Advertisements