// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package jwj

sealed class X permits X1, X2 {
}

class X1 extends X {
}

class X2 extends X {
}

void test(X o) {
    if(o instanceof X1) {
        println("X1")
    } else {
        println("X2")
    }
}

test(new X2())
