forked from JavaTX/JavaCompilerCore
18 lines
385 B
Java
18 lines
385 B
Java
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
|
|
} |