The following code is supposed to return the last value in arraylist if it has one, if not, how could I return the exception?
public int getLast() {
try {
return arrl.get(arrl.size() - 1);
} catch (Exception e) {
System.out.println("Caught "+ e);
}
}
arrl here is ArrayList
I excuted above code and received "error: missing return statement"