Catch exception in Scala constructor
What is the Scala equivalent of this Java code, where
someMethodThatMightThrowException is defined elsewhere?
class MyClass {
String a;
String b;
MyClass() {
try {
this.a = someMethodThatMightThrowException();
this.b = someMethodThatMightThrowException();
} finally {
System.out.println("Done");
}
}
}
No comments:
Post a Comment