O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4. Declarations and Access Control

4.1
public class EditContext {

    private Object selected;

    public void setSelected(Object newSelected) {
        selected = newSelected;
    }

    public Object getSelected() {
        return selected;
    }
}
4.2
public interface Tool {
    public void setContext(EditContext newContext);
    public boolean isActive();
}
4.3
 // Filename: Database.java // Specify package package com.megabankcorp.system; // Allow usage of Account class simply by referring to the name Account. import com.megabankcorp.records.Account; // Class must be abstract since it has abstract methods. public abstract class Database { // Abstract and available from anywhere. public abstract void deposit(Account acc, long amount); // Abstract and available from anywhere. public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required