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

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.