package definedexception;
public class Test{
private int array[] = { 2,4,6,7,9,};
public void act()
{
for(int x=0; x< array.length; x++)
{
try {
if( array[x]==6)
{System.out.println(+x);}
else {throw new illegalelementException();}
break;
}
catch(illegalelementException e)
{System.out.println(e.getMessage());}
}
}
public static void main(String[] args) {
Test t1 = new Test();
t1.act();