title: Java: Assigning Non Static Variable to Static Variable
body: <p>I'm using a class called <code>GlobalVar</code> to store some global variables required for the entire application. The class looks something like this:</p>
  
  <pre><code>public class GlobalVar {
  
      MyProps props = new MyProps();
  
      public GlobalVar() throws Exception
      {
  
      }
  
      public static String PPFirstName = "Kim";
      public static String PPLastName = "Smith";
  
  
      String zip = props.Props.getIPZip("IPZip");
      public static String IPZip = zip;
  
  }
  </code></pre>
  
  <p>However, in the last two lines I'm getting the error:</p>
  
  <pre><code>Cannot assign non static variable to static variable. 
  </code></pre>
  
  <p>I understand the source of the problem (as <code>zip</code> is non static and <code>IPZip</code> is static) my question is: Is there any way around this? I.e, any way to assign the value set in <code>"Props"</code> to <code>"IPZip"</code> static var?</p>
  
  <p>Note: The purpose of using this method is that I am able to use the syntax <code>GlobalVar.IPZip</code> anywhere in the application..</p>