title: How Shared Preferences in Android Works?
body: <p>I came across an Android Question as follows. The result is confusing me.</p>
  
  <pre><code>SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode
          SharedPreferences.Editor editor = pref.edit();
          editor.putString("1", "2"); // Storing string
          editor.putString("3", "4 "); // Storing string
          editor.commit();
          System.out.println("pref.getString() = " + pref.getString("2","3"));
  </code></pre>
  
  <blockquote>
    <p>Answer:  pref.getString() = 3.</p>
  </blockquote>
  
  <p>How does the shared preference prints this value ? Can someone please explain this ?</p>