Chapter 3
Discovering Classes and Objects
In Chapter 2, I introduced you to the fundamentals of the Java language. You now know how to write simple applications by inserting statements into a class’s main() method. However, when you try to develop complex applications in this manner, you’re bound to find development tedious, slow, and prone to error. Classes and objects address these problems by simplifying application architecture.
In this chapter, I will introduce you to Java’s support for classes and objects. You will learn how to declare classes, construct objects from classes, encapsulate fields and methods in classes, restrict access to fields and methods, initialize classes and objects to appropriate startup values, and remove objects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access