pode me ajudar a gerar IllegalArgumentException e IllegalStateException?
/**[code]
* Método main que lança java.lang.ClassCastException
* @param args
*/
public static void main(String[] args) {
TestarExcecoes t = new TestarExcecoes();
new TestarExcecoes().metodoGeraIllegalArgumentException(t);
}
TestarExcecoes metodoGeraIllegalArgumentException(TestarExcecoes t1){
if (t1.equals( this )){
throw new IllegalArgumentException("Objeto diferente!");
}
else
System.out.println("Ok");
return t1;
}[/code]