samples/incompatibilities/src-wildimport/org/apidesign/stringandbuffer/AppendStringBuffer.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:57:02 +0200
changeset 138 473cf6bb7084
permissions -rw-r--r--
Example of append(StringBuffer)
     1 package org.apidesign.stringandbuffer;
     2 
     3 /** This code compiles on 1.3 as well as 1.4. However, if compiled on
     4  * 1.4, it will throw <code>NoSuchMethodError</code> when executed on
     5  * 1.3. How is that possible?
     6  */
     7 public class AppendStringBuffer {
     8     static {
     9         // BEGIN: theory.appendstringbuffer
    10         StringBuffer sb = new StringBuffer();
    11         StringBuffer another = new StringBuffer();
    12         sb.append(another);
    13         // END: theory.appendstringbuffer
    14     }
    15 }