The reason behind this is bracket placement, what you have actually done in yurs is place the catch statement within the try statement
try
{
if ("y".equals(strInput))
{
System.out.println("Do you like Marilyn Manson?:");
strInput = dataIn.readLine(); //reads data from console
if ("y".equals(strInput))
{
System.out.println("You are a hardcore Rocker");
}
else if ("n".equals(strInput))
{
System.out.println("How could you not like Marilyn Manson?");
}
else
{
System.out.println("Illegal input: " + strInput);
}
}
else if ("n".equals(strInput))
{
System.out.println("Ok, bye rock hater!");
}
}
catch (TheException e)
{
System.out.println("" + e + " input: " + strInput);
}
System.out.println();
System.out.println("Program Ending!");
}
}
Note i have also removed the else statement. Now you will be given a different error converning the fact that TheException is never thrown in the try statement, this i'll let you look into.
If you do still need help on this just ask, but as a clue what exception are you trying to catch? and what throws it?
Cheers,
Chris