> Can someone explain to my java quiz solution to me, I'm so confused?

Can someone explain to my java quiz solution to me, I'm so confused?

Posted at: 2014-12-18 
public class Program {

public static void main(String[] args) {

try {

caller();

} catch (OtherException ex) {

System.out.println("Beach Time"); // Output: 3

}

}



private static void caller() throws OtherException {

System.out.println("Sunny"); // Output: 1

String str = "Beach Time";

if (str.equals("Beach Time")) { // it should be "Beach Time" and always TRUE then...

throw new OtherException("Thunderstorm");

System.out.println("Flooding"); // as exception throws never reach this part...

}

}

}

class OtherException extends Exception {

public OtherException(String str) { // Thunderstorm was sent but never use...

System.out.println("Shower"); // Output: 2

}

}

Here are the solutions, which confuses me

output line 1 : Sunny

output line 2: Shower

output line 3: Beach Time

public class OtherException extends Exception {

public OtherException(String str) {

System.out.println("Shower");

}

}

public class Quiz2 {

public static void main(String[] args) {

try {

caller();



} catch (OtherException ex) {

System.out.println("Beach Time");

}

}

public static void caller() throws OtherException {

System.out.println("Sunny");

String str = "Beach Time";

if(str.equals("Sunny"))

throw new OtherException("Thunderstorm");

System.out.println("Flooding");

}

}