title: Why don't we make everything static?
body: <p><strong>Why can't we just make all methods and variables static, to save ourselves from the hassle of making objects?</strong></p>
  
  <p>I have actually had this question ever since I started learning Java a long time ago, but never asked it. I know that if a method or variable is not static, you can call it using an object you create:</p>
  
  <pre><code>public class classwithmethodandvariable {
  
      int i = 7;
  
      public void hello() {
      }
  
  }
  </code></pre>
  
  <p>You can call this like so:</p>
  
  <pre><code>public class myMainClass {
  
      classwithmethodandvariable obj = new classwithmethodandvariable();
      classwithmethodandvariable.i++;  // ACCESS INT I AND INCREMENT
      classwithmethodandvariable.hello();  // CALLS METHOD HELLO
  
  }
  </code></pre>
  
  <p>But, if we had made the method <code>hello()</code> and variable <code>i</code> we could have done everything with less lines of code, right?</p>
  
  <pre><code>public class classwithmethodandvariable {
  
      static int i = 7;
  
      public static void hello() {
      } 
  
  }
  </code></pre>
  
  <p>You can call this like so:</p>
  
  <pre><code>public class myMainClass {
  
      classwithmethodandvariable.i++;  // ACCESS INT I AND INCREMENT
      classwithmethodandvariable.hello();  // CALLS METHOD HELLO
  
  }
  </code></pre>
  
  <p>Why don't we do that? I have seen <a href="https://stackoverflow.com/questions/11555897/why-cant-i-just-declare-all-methods-static">another question</a> like this, but the answer says “Because you can't access instance variables from static methods”. But then what if you make the variables also <code>static</code>?</p>