/* Author: Mr. F Purpose: Demonstrates how scope works Class: Scope Date: 9/30/07 */ public class Scope { public static void main(String[] args) { int x = (int)(Math.random() * 6) + 1; //die roll int y = (int)(Math.random() * 6) + 1; //die roll if(x < 3) { if(y < 3) { //int score = 0; } else { //score = 1; } //System.out.println(score); } else if(y < 3) { //int score; if(x < 3) //this case will never happen... do you know why? { //score = 1; } else { //score = 2; } //System.out.println(score); } else //what case is this? { //int score = 3; } //System.out.println(score); } }