Scope of variable: region of program where you can refer to the
variable by its name
Local variable scope: from definition to end of block
Class scope: all methods of the class
Must qualify public members outside scope, e.g.
Math.sqrt
Overlapping scope: local scope wins over class scope
public class Coin
{
public void draw(Graphics2D g2)
{
String name = "SansSerif"; // local scope
g2.setFont(new Font(name, . . .)); // local name
g2.drawString(this.name, . . .); // field name
}
private String name; // class scope
. . .
}