title: When do static variables get garbage collected?
body: <p>I have a static factory method which will return a fragment object.   </p>
  
  <pre><code>private static String  final A1="a1";
  private static String  final A2="a2";
  private static String  final A3="a2";
  private static String  final A4="a4";
  
  public static MyFragment newInstance(int index) {
      MyFragment f = new MyFragment();
      Bundle args = new Bundle(4);
      args.putInt(A1, index);
      args.putInt(A2, index);
      args.putInt(A3, index);
      args.putInt(A4, index);
      f.setArguments(args);
      return f;
  }
  </code></pre>
  
  <p>And am getting it within <code>oncreate()</code></p>
  
  <pre><code>getArguments().getInt(A1, 0);
  </code></pre>
  
  <p>Now my question is: I am creating couple of <code>MyFragment</code> object like below</p>
  
  <pre><code>List&lt;Fragment&gt; fragments = new ArrayList&lt;&gt;();
  fragments.add(MyFragment.newInstance(defaultId));
  int i = 1;
  for (Categories categories : mCategories) {
      String id = categories.getCategory_id();
      String name = categories.getCategory_name();
      //  String slno = categories.getSlno();
      fragments.add(MyFragment.newInstance(defaultId));
      Titles[i] = name;
      i++;
  }
  </code></pre>
  
  <p>As the variables A1-A4 as static will it clear it's memory on activity destroy ? or i need to assign the variables as <code>null</code> in onDistroy ?</p>
  
  <p>Please help me to clarify the doubt ?</p>