You have a semicolon at the end of the for loop line which terminates the loop prior to the println statement, and causes the variable j to go out of scope.