In Java, b1's "private" instance variables can be accessed by not only b1, but also by all other objects in b1's class. ---------------------------------------------------------- --- Example (Book class) /* public */ class Book { private String title = "Some Title"; private String author = "John Jones"; private int year = 1999; public static Book otherBook; //a class variable to tell b2 & all other //Books that b1 exists. // ------------- // Accessors: public String getBothTitles() { // every book also reports b1's (private) title. return title + otherBook.title; } public String getTitle() { return title; } ... } ---------------------------------------------------------- --- Instantiating and using Books /* Example application Required header comments have been omitted */ import java.lang.reflect.Array; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public class TestApplication { public static void main (String[] args) throws IOException { /* AbstractClass a = new AbstractClass(); wont compile, of course */ Book b1 = new Book(); Book b2 = new Book(); b1.setTitle("Java"); b2.setTitle("Fortran"); Book.otherBook = b1; //now b2 can find out about b1. System.out.println (b2.getBothTitles()); } } ---------------------------------------------------------- --- Sample run: gold> java TestApplication FortranJava