Can i have multiple independent if statements within a try block with only one catch statement in order to set a value?
From my understanding if statement 1 throws an exception then the value of x could never be set through statement 2 and 3 so would it be better if i use if-elseif statements or is there a better solution to achieve this?
You shouldavoid exceptions in Scala if possible. Of course, sometimes they are necessary, in which case you will need to handle them properly. But you should not use them simply as branching logic, as you seem to be doing here. For example, one common alternative is to return an Option from your function and allow the calling function to handle the result i.e. Some(value) or None gracefully without the need for an exception.
There are several books and websites around to help Java programmers make the transition to Scala more easily, so here are a few places for you to start your Scala journey: