title: How to access a variable outside a try catch block
body: <p>I'm trying to <strong>return a boolean value</strong> from my function having <strong>try-catch block</strong>,</p>
  <p>But the problem is I cant return any value.</p>
  <p>I know that a variable inside a try-catch block can't be accessed outside it, but still I want to access it somehow.</p>
  <pre><code>public boolean checkStatus(){
          try{
          
          
          InputStream fstream = MyRegDb.class.getClassLoader().getResourceAsStream(&quot;textfile.txt&quot;);
          // Use DataInputStream to read binary NOT text.
          BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
          String strLine;
                                                  
          //Read File Line By Line
          strLine = br.readLine();
          // Print the content on the console
          System.out.println (strLine);
          
          ind.close();
          if(strLine.equals(&quot;1&quot;)){
              
              return false;   
          }else{
              return true;    
          }
          
      }catch(Exception e){}
  }   
  </code></pre>
  <p>I know that it has error saying <strong>return statement missing</strong>  but I want program exactly working like this.</p>
  <p>Now the <strong>reason I'm strict to this</strong></p>
  <p>In my jar file I have to access text files for finding values 1 or 0 if &quot;1&quot; then activate else deactivate.</p>
  <p>that is why I am using Boolean.</p>