19 lines
354 B
Java
19 lines
354 B
Java
import java.lang.Integer;
|
|
import java.lang.Double;
|
|
import java.lang.String;
|
|
|
|
public class Instanceof{
|
|
void checkInstanceof() {
|
|
var a = 4;
|
|
return (a instanceof java.lang.Integer);
|
|
}
|
|
|
|
void checkInstanceOfWithPattern(){
|
|
var b = 4.0;
|
|
if(b instanceof java.lang.Double d){
|
|
return d;
|
|
}else{
|
|
return "Kein Double";
|
|
}
|
|
}
|
|
} |