Search code examples
javaparentheses

Quick, Petty Java Question: Parenthesis around SQLException


  try {
      ...
  }  catch (SQLException sqle) {
      String theError = (sqle).getSQLState();
      ...
  }

What does surrounding sqle with parenthesis do? Anything?

Just curious.


Solution

  • Quick reply - Nothing.

    Longer reply - It might be a vestigial remnant of an inline cast:

    ((SomeMoreSpecificException)sqle).get...