In this case it works because break
exits the loop and goes to the end of the method which immediately returns. Which is functionally equivalent to returning immediately.
But in this case, for example
void run(){ while(true){ if(a>0){ }else{return;} } System.out.println("Hello");}
vs
void run(){ while(true){ if(a>0){ }else{break;} } System.out.println("Hello");}
The first version would not print, the second would