1 / 7

Java While Loop

As we are discussed in the previous file, the java while loop is used to repeat the part of the program many times. If the number of repetitions is not fixed, then the while loop is used.

Ducat1
Download Presentation

Java While Loop

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to Ducat India Language | Industrial Training | Digital Marketing | Web Technology | Testing+ | Database | Networking | Mobile Application | ERP | Graphic | Big Data | Cloud Computing Apply Now Call us: 70-70-90-50-90 www.ducatindia.com

  2. Java While Loop As we are discussed in previous file, java while loop is used to repeat the part of the program many times. If the number of repetition is not fixed, then while loop is use. Syntax while (condition) { statements (s) } Flowchart

  3. In above flowchart shows, firstly, condition is evaluated and if condition is true then statement in while loop is executed. If condition is false, then it comes to out of the loop and go to next statement. Example public class whileLoopExample{ public static void main(String[]args){ int i=1; while(i<=15){ System.out.println(i); i++; } } }

  4. Output 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

  5. Infinitive While Loop In while loop if we pass true it will be infinitive while loop. Syntax while (true){ statement(s); } Example class WhileInfinitiveExample2 { public static void main(String[] args) { while(true){ System.out.println(“infinitive while loop”); } } }

  6. Output infinitive while loop infinitive while loop infinitive while loop infinitive while loop infinitive while loop ctrl+c Ctrl+c is use to exit the program

  7. Thank You!! Call us: 70-70-90-50-90 www.ducatindia.com

More Related