Throws
From Abap2Java
[edit]
ABAP
[edit]
Java
The keyword throws indicates that a method might throw an exception.
class URLConnect {
public String fetchUrl(String url) throws java.io.IOException {
...
}
}
When calling a method that declares a throws statement you can either declare the calling mehtod with throws or you can use a try-catch-finally declaration.
// bubbling the Event upwards
public Object evaluateURL(String url) throws java.io.IOException {
...
String s = urlconnect.fetchUrl(url);
...
}
// using try-catch-finally try { ... String s = urlconnect.fetchUrl(url); ... } catch (java.io.IOException e) { e.printStackTrace(); }

