You can use only one exception at a time. You cannot do what you ask. Instead, consider using custom exceptions in your code and use them as appropriate (I'm not sure why you need to throw two exceptions):
class CustomException extends Exception {
and then toss it when you need:
public void doA() throws Exception1, Exception2{ throw new CustomException("test1, test2"); }
source share