Behaviors are the actions an object can perform and are written as methods. At the moment we have a class that can be initialized but doesn't do much else. Let's add a method called "displayBookData" that will display the current data held in the object:
public class Book {
//fields
private String title;
private String author;
private String publisher;
//constructor method
public Book(String bookTitle, String authorName, String publisherName)
{
//populate the fields
title = bookTitle;
author = authorName;
publisher = publisherName;
}
public void displayBookData()
{
System.out.println("Title: " + title);
System.out.println("Author: " + author);
System.out.println("Publisher: " + publisher);
}
}
All the displayBookData method does is print out each of the class fields to the screen.
We could add as many methods and fields as we desire but for now let's consider the Book class as complete. It has three fields to hold data about a book, it can be initialized and it can display the data it contains.

