title: How to assign file content into a variable in Java
body: <p>I have a .txt file in various variables are there(each are separated by a line). I need to read .txt file and assign it to corresponding variables as in txt file.
  <strong>No need to be in same order</strong></p>
  
  <p>input.txt</p>
  
  <pre><code>int a=3;
  boolean b=true;
  String sr = "Hai";
  </code></pre>
  
  <p>what I tried </p>
  
  <pre><code>int a;
  boolean b;
  String sr;
  String CurrentLine;
  br = new BufferedReader(new FileReader("C:\\input.txt"));
  while ((CurrentLine = br.readLine()) != null) {
      \\ need to read assign variables to corresponding variables in test file
  }
  </code></pre>
  
  <p><strong>Is is possible to declarer variables in file and read in main()?</strong></p>