Should be:
public static double average() {
double avg;
try{
and further down:
System.out.println("The sum is: " + sum);
avg = sum / tnum;
System.out.println("The average is: " + avg);
That will do it. As others said, the way avg is defined it is only local to the try scope that encloses it, i.e., avg is not available in the finally block.