Chapter 4
Object-Oriented Programming in Java
In This Chapter
Using classes with finesse
Working with Java’s classes and interfaces
Being part of Java’s inner circle
Putting your eggs (your file, that is) in a basket
If you remember nothing else about Java, remember these ideas from Chapter 2 of this minibook:
Java is an object-oriented programming language. So, as a developer, your primary goal is to describe objects. Your closely related goal is to describe objects' close cousins — namely, classes. A class is the idea behind a certain kind of thing. An object is a concrete instance of a class.
And if you remember nothing else about those ideas, remember the following two-word summary:
Classes; objects.
Chapter 2 in this minibook covers the highlights of object-oriented programming in Java. This chapter covers some of object-oriented programming’s finer points.
Static Fields and Methods
In Listing 4-1, I reproduce a small portion of the source code of Android’s Toast class.
Listing 4-1: An Unrepresentative Sample of Android’s Toast Class Code
public class Toast {
public ...
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