参照変数と型を比較する際にinstanceof演算子を使用しています。
#1 if (obj instanceof String){
#2 String str = (String) obj;
}
#1でobjがStringに変換可能なら、trueになる。
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 1 year has passed since last update.
参照変数と型を比較する際にinstanceof演算子を使用しています。
#1 if (obj instanceof String){
#2 String str = (String) obj;
}
#1でobjがStringに変換可能なら、trueになる。
Register as a new user and use Qiita more conveniently
Go to list of users who liked