My friend,
yol'll cannot have a method with some type instead void, without getting a result back. Your problem is that you need to put the "return" outside the Try/Catch block. Otherwise, the compiler will not be able to return something, and it is a necessity. So, the possible way could be:
public class test {
public java.lang.String testVar;
/** Creates a new instance of teste */
public test() {
}
public static void main(java.lang.String[] args){
test t = new test();
t.pushValue();
}
public void pushValue(){
try{
testVar = "oi";
}catch(java.lang.Exception e){
System.out.println("Wrong teste "+e.getMessage());
}
}
}
So, the variable is inicialized just, and just, when the try is respected. Thus, this could help you??
Bye.