I have run into an issue where I have to override Object\'s toString() method, but the original method doesn\'t throw any exceptions. However, I am using some generic code t
If you really need to throw an exception without surrounding your code with a try and catch
@override
public String toString(){
if(...)throw new IllegalStateException("list is empty");
else if(...)throw new IllegalStateException("position is invalid");
return ...;
}