title: "Double casting"
body: <p>I'm currently tutoring a high school student in AP Java and she asked me a question about "double casting". I did not ever hear of this term before, but apparently her teacher expects her to know it for their upcoming final.</p>
  
  <p>The example her teacher provided was if you wanted to cast an Integer into a String, you would have to do the following to not get a compiler error:</p>
  
  <pre><code>Integer i = new Integer(5);
  String s = (String)(Object) i;
  </code></pre>
  
  <p>The question is: when would you want to do this in real life?</p>
  
  <p>The teacher only provided examples which result in a run time error. Also, I never really knew there was a term for this, but it just seems like a bad idea to do it because there's only an error when the two types are incompatible.</p>
  
  <p>Thanks!</p>