how to run an infinite loop in java code example Example: write an infinite loop java while(true) { //do whatever }