if pos2[targetPos3] does not point to a hashset (is not a hashset) という if ステートメントをどのように記述しますか? 私はそれを試しましたが、それでもヌルポイント例外が発生します。
Object[] pos2;
int targetPos3;
targetPos3 = word.charAt(2) - 'a';
if(pos2[targetPos3] != (HashSet<String>) pos2[targetPos3]){
System.out.println("Sorry");
}