title: Declare a global variable, or declare multiple times in each class
body: <p>Simple question.  Reviewing my code, I've noticed that I've got a lot of variables declared multiple times in my classes or methods...for example:</p>
  
  <pre><code>public Long dbInsertCheckin(final String Class) {
  final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  ...
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class SmashDataSource {
      final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      final SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
      final SimpleDateFormat timeFormat = new SimpleDateFormat("HHmm");
  ...
  }
  </code></pre>
  
  <p>this got me thinking that instead of declaring "dateformat", "sdf", or "timeformat" or others i use in multiple places, would it not make more sense for me to declare these globally in my application class, then refer to them wherever I wanted like</p>
  
  <pre><code>public class MyApp extends Application {
  public final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      public final SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
      public final SimpleDateFormat timeFormat = new SimpleDateFormat("HHmm");
  </code></pre>
  
  <p>and refer to them later in other classes as such:</p>
  
  <pre><code>MyApp.dateformat
  Myapp.sdf
  </code></pre>
  
  <p>Would this be better from a performance/memory usage point of view?  Is there any reason not to do this?  To me, it would seem that having declared them multiple times would consume more memory, vs. a  final declaration once.... but I don't know how the compiler does it's optimizations.</p>