Presentation is loading. Please wait.

Presentation is loading. Please wait.

Controlling Program Flow

Similar presentations


Presentation on theme: "Controlling Program Flow"— Presentation transcript:

1 Controlling Program Flow
Chapter 3 Controlling Program Flow CCE JMU CHINA

2 What’s Inside 1、Operators 2、Execution control CCE JMU CHINA

3 CCE JMU CHINA

4 CCE JMU CHINA

5 CCE JMU CHINA

6 CCE JMU CHINA

7 CCE JMU CHINA

8 CCE JMU CHINA

9 CCE JMU CHINA

10 Comments • The three permissible styles of comment in a Java technology program are: // comment on one line /* comment on one or more lines */ /** documentation comment */ CCE JMU CHINA

11 Semicolons, Blocks, and White Space
• A statement is one or more lines of code terminated by a semicolon (;): Example: totals = a + b + c + d + e + f; CCE JMU CHINA

12 Semicolons, Blocks, and White Space
• A block is a collection of statements bound by opening and closing braces: { x = y + 1; y = x + 1; } CCE JMU CHINA

13 Semicolons, Blocks, and White Space
• You must use a block in a class definition: public class MyDate { private int day; private int month; private int year; } • You can nest block statements. • Any amount of white space is allowed in a Java program. CCE JMU CHINA

14 CCE JMU CHINA

15 if & if-else CCE JMU CHINA

16 CCE JMU CHINA

17 CCE JMU CHINA

18 CCE JMU CHINA

19 while & for CCE JMU CHINA

20 CCE JMU CHINA

21 CCE JMU CHINA

22 CCE JMU CHINA

23 CCE JMU CHINA

24 CCE JMU CHINA

25 CCE JMU CHINA


Download ppt "Controlling Program Flow"

Similar presentations


Ads by Google