9:23 am - Wednesday December 19, 2018

Java Example Program using while Loop

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/*program for While Loop statement*/
/**
 * @author:candidjava.com
 * @description:Print the counts the number usinr while loop
 */
public class WhileLoopExample {
	public static void main(String args[]) {
		// initialize a variable
		int i = 1;
		// check the condition
		while (i < 11) {
			// print the output
			System.out.println("Count is: " + i);
			// increment the i value
			i++;
		}
	}
}


OUTPUT:
Count is: 1
Count is: 2
Count is: 3
Count is: 4
Count is: 5
Count is: 6
Count is: 7
Count is: 8
Count is: 9
Count is: 10

Filed in: Z-A All Java Codes

Comments are closed.