01. Example:
import java.util.Scanner; class BreakContinueWhileLoop { public static void main(String[] args) { int N; Scanner input = new Scanner(System.in); while (true) { System.out.print("nInput An Integer: "); N = input.nextInt(); if (N != 0) { System.out.println("nYou Entered: " + N); continue; } else { System.out.println("nYou Entered Zero. It is while Loop Breaking condition."); break; } } } }
Output:
Input An Integer: 10
You Entered: 10
Input An Integer: 20
You Entered: 20
Input An Integer: -10
You Entered: -10
Input An Integer: 0
You Entered Zero. It is while Loop Breaking condition.