forked from JavaTX/JavaCompilerCore
18 lines
385 B
Plaintext
18 lines
385 B
Plaintext
|
import java.lang.Number;
|
||
|
import java.lang.Integer;
|
||
|
import java.lang.Double;
|
||
|
import java.lang.String;
|
||
|
|
||
|
public class InstanceOf {
|
||
|
main(n) {
|
||
|
if (n instanceof Integer i) {
|
||
|
takes(i);
|
||
|
return "Integer";
|
||
|
} else if (n instanceof Double d) {
|
||
|
takes(d);
|
||
|
return "Double";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
takes(i) {} // Should be overloaded
|
||
|
}
|