In past lessons, you learned more about what a typical Java program is and what its design looks like. How objects are created (and what this has to do with constructors) and how variables are initialized.
Brace yourself: there will be a lot of extra reading this time. But this is the very thing that will help you move forward faster in your learning.
Why do you need a constructor?
You've already come across the answer to this question in previous lessons, haven't you? Let's test. How do you create a featureless default cat, and how do you create the same cat, but with a specific fur color and meow? Not sure? Then read this article on the very basics of Java constructors. Read and be enlightened :)
Base class constructors
You're just getting started with constructors in Java, so another interesting article shouldn't hurt. It is dedicated to base class constructors, and it is precisely targeted at your level of knowledge. This article will reveal (or allow you to review) what a superclasses and derived classes are, the order that constructors are called, and the order that fields are initialized in.
Methods, parameters, interactions, and overloading
Now then, methods... Without them, objects have no idea how to behave or interact with each other. This solid lesson will pump up your knowledge of methods and method parameters. We will also touch on the important topics of encapsulation and method overloading. If these topics are not clear yet, don't worry. We will definitely come back to them later.
Getters and setters
Once upon a time, you didn't know what encapsulation is and why it is needed. Or perhaps even now you don't feel confident enough when it comes to data hiding and and Java mechanisms used to accomplish it — getters and setters. If that's the case, then here is a very helpful lesson that is likely to solidify your understanding of encapsulation.
When the Java machine creates any object, it allocates memory for that object. In a real large program, tens and hundreds of thousands of objects are created, and each of them has its own piece of memory allocated for it.
But how long do you think all these objects exist? Do they "live" the entire time our program is running? Of course not. Even with all the advantages of Java objects, they are not immortal :) Objects have their own lifecycle. In this lesson, we'll explore what that is.
More about the garbage collector
If you read the lesson above, you'll become familiar with the concept of a "garbage collector". Now in this article, you get a more detailed discussion of how garbage collection is distributed over time. Java's garbage collector is kind, though it is not always predictable for mere mortals. Read this fun article to learn about Java garbage collection, object reachability, reference counting, and object generations.
GO TO FULL VERSION