Question: Before you say that this question has already been answered tons of times, here is my code snippet:

```
final int x;
try {
    x = blah(); 
} catch (MyPanicException e) {
    abandonEverythingAndDie();
}
System.out.println("x is " + x);

```

If invoking `abandonEverythingAndDie()` has the effect of ending the execution of the whole program (say because it invokes `System.exit(int)` ), then `x` is always initialized whenever it is used. 

Is there a way in the current Java language to make the compiler happy about variable initialization, by informing it that `abandonEverythingAndDie()` is a method which never returns control to the caller? 

I do **not** want to 

* remove the `final` keyword
* initialize `x` while declaration,
* nor to put the `println` in the scope of the `try...catch` block.

Answer: 
Surely the simplest, and least hacky approach is just to use a temporary variable...

```
final int x;

int temp;   
try {
    temp = blah(); 
} catch (MyPanicException e) {
    abandonEverythingAndDie();
}
x = temp;
System.out.println("x is " + x);

```

Simple.
I am not sure if that is an option but you can add 

```
throw new RuntimeException()

```

or 

```
return;

```

in your catch

```
final int x;
try {
    x = blah(); 
} catch (MyPanicException e) {
    abandonEverythingAndDie();
    throw new RuntimeException(); // here
}
System.out.println("x is " + x);

```

Even if this added `throw` will not be executed because of `abandonEverythingAndDie`, compiler will know that flow of control from this `catch` block can't go back to `System.out.println("x is " + x);` so it will not require initialization of `x`.