Answer:
You need to wrap the statements of loop in curly braces {} if the statements are more than one. In your case loopcounter=loopcounter+1 is out of loop
Step-by-step explanation:
// Do it like this will make it finite loop
int loopCount = 1
while(loopCount < 3) {
System.out.println("Hello");
loopCount = loopCount + 1;
}