title: Can understand setters and getters in java
body: <p>I'm new to java, but I like the language and I want to become as good as possible but I still have some difficulties with the "class" thing.
  I understand what a class is and what objects are but still I cant understand well getters and setters </p>
  
  <p>I know a class has</p>
  
  <ul>
  <li>Instance variables</li>
  <li>Constructors</li>
  <li>Methods</li>
  <li>Setters and getters ?</li>
  </ul>
  
  <p>I can't understand well why do I need them and if I should write those inside a constructor.</p>
  
  <p>Also like to point out that I've read several internet articles but</p>
  
  <ol>
  <li>those were to much "technical"</li>
  <li>they just write a code without instance variables, constructors so I can't understand very well </li>
  </ol>
  
  <p>Your help is very appreciated even if you are a beginner like me ^^</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>For example how i should use the setters and getters here?</p>
  
  <pre><code>class Demo {
  
      int a=4;
      Int b;
  
      public Demo () {
          System.println("a is &lt;than b")
      };
  
      public int Demo (int b) { 
          if (a&lt;b)
              System.out.println("a is &lt; than b");
          else
              System.out.println("b is &lt; than a");
      } 
  }
  </code></pre>