Check out example codes for "write an infinite loop java". It will help you in understanding the concepts better.

Code Example 1

while(true) {
  //do whatever
}

Learn ReactJs, React Native from akashmittal.com