title: Does Kotlin break the rule of encapsulation?
body: <p>Variables are used <strong>public</strong> in classes using the <strong>default visibility modifier</strong>. A setter and a getter is created for every member variable, but in Kotlin you do for example:</p>
  
  <pre><code>class Person {
      var name: String = "unknown"
  }
  
  fun main(args: Array&lt;String&gt;) {
      val person = Person()
      person.name = "kevvex"
      println("${person.name}")
  }
  </code></pre>
  
  <p>Is this still not breaking the rule of encapsulation due to the getter and setter being applied when using:</p>
  
  <pre><code>person.name = "kevvex"
  </code></pre>
  
  <p>If so, how can that be encapsulation? The variable is still public. Declaring it as private would force me to create a setter and getter to get the variable, because of the private visibility modifier.</p>
  
  <p><strong>I'm comparing to Java that often has member variables as private and a public setter and getter for every member variable</strong>. </p>