Chapter 4

Object-Oriented Programming in Java

In This Chapter

check1 Using classes with finesse

check1 Working with Java’s classes and interfaces

check1 Being part of Java’s inner circle

check1 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 ...

Get Android Application Development All-in-One For Dummies, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.