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 ...
Get Learn Java for Android Development, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.