In first method howToDoInJava_method1(), second print statement is unreachable, so compiler will complain for oblivious reasons.
In second method howToDoInJava_method2(), second print statement is also unreachable, but strange compiler only warns you. We will later try to get the logic here.
In third method howToDoInJava_method3() also, second print statement is unreachable, so compiler will complain again.
https://howtodoinjava.com/java/puzzles/dead-code-and-unreachable-code-in-java-puzzle/