Hi,
in the following code the integer a does not appear to be inscope when I try and return it? It is fine when I declare it outside of the try statement but when I declare it inside I get the following error when I compile:
"Variable 'a' not found in class ....."
What am I doing wrong, I'm sure it is something simple, knowing me!
public static int openaconnection(){
try{
int a = 10;
}
catch(Exception g){
}
return(a);
}
in the following code the integer a does not appear to be inscope when I try and return it? It is fine when I declare it outside of the try statement but when I declare it inside I get the following error when I compile:
"Variable 'a' not found in class ....."
What am I doing wrong, I'm sure it is something simple, knowing me!
public static int openaconnection(){
try{
int a = 10;
}
catch(Exception g){
}
return(a);
}