Java Chapter Fifth

Source: Internet
Author: User

     Loop structure 1      while loop structure, Do-while loop structure.          Loop structure:  Two conditions must be met. 1, cycle conditions and cycle operation! While         Loop      features: First judge, then execute, code specification: Indentation, newline!    Flowchart: Start-and-Declare count and assign  -count<=50 if False jumps to the end code block.    If True, start printing count++! Public          static void Main (string[] args) {          int count =1;          while (count<=50) {                    System.out.println ("Print section" +count+ "paper");            Count + +;       }    }
Why you need program debugging
Problem:
In the process of writing a program sometimes errors, but not to find and locate errors, there is no good way?

Analysis:
Read through code or add output statements to find program errors
When the structure of the program becomes more and more complex, special techniques are needed to find and locate errors, which is "program debugging"

What is Program debugging:

     
int i = 1;

SYSTEM.OUT.PRINTLN ("program debug demo, pay attention to the value of I:");

Step 2: Start debugging
Step 3: Single Step operation
After debugging is started, the code line that runs to the set breakpoint stops clicking the F6 key to step through the program, observing the program's running process

F5: Step Into F6: Single Step Skip





Summary: 1, the purpose of the program debugging?
Identify causes of defects and fix defects

2, the main method of program debugging?
Setting breakpoints, stepping, observing variables


The difference between a while loop and a do-while loop
Different syntax
Different execution order
When the initial condition does not meet the cycle condition
The while loop does not execute at once
Do-while cycle is performed at least once in any case

Summarize:

Java Chapter Fifth

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.