title: Different methods for casting an object in Java
body: <p>I know the three following methods that can be used for casting objects.</p>
  
  <pre><code>Object o = "str";
  
  String str1 = (String) o;                // Method 1
  
  String str2 = o.toString();              // Method 2
  
  String str3 = String.class.cast(o);      // Method 3
  </code></pre>
  
  <ol>
  <li>Which approach is better, and what are the pros/cons of one method as compared to the others?</li>
  <li>What happens to the object during the time of casting internally?</li>
  </ol>