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 Chapter 3 I introduce you to Java’s support for classes and objects. You learn how to declare a class and instantiate objects from the class, how to declare fields within the class and access these fields, how to declare methods within the class and call them, how to initialize classes and objects, and how to ...

Get Learn Java for Android Development, Second 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.