4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

instanceof演算子で"Incompatible conditional operand types"が出る場合の対応(eclipse)

Posted at

Eclipseでjavaコーディング中に、クラスのオブジェクトを比較するinstanceof演算子を利用した時に、"Incompatible conditional operand types"というエラーが出る場合の対応方法。

if(mActivity instanceof HogeActivity){
...
}
//=>"Incompatible conditional operand types Activity and HogeActivity"

原因

Eclipseで適切なクラスファイルがimportされていないため。

対応方法

以下をimportする。

import com.hoge.Hoge.Activity
4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?