Presentation is loading. Please wait.

Presentation is loading. Please wait.

200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 Expressions Methods if else Statements Loops Potpourri.

Similar presentations


Presentation on theme: "200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 Expressions Methods if else Statements Loops Potpourri."— Presentation transcript:

1 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 Expressions Methods if else Statements Loops Potpourri

2 8 % 20

3 8

4 ((20 % 8) / 3) * (20 / 8)

5 2

6 15 >= 7 >= 0

7 INVALID

8 (15 >= 7) && !true

9 false

10 (23 / 7 > 2) || (23 % 7 > 2)

11 true

12 This line contains a method return type.

13 45

14 This line contains a formal parameter

15 5 or 45

16 This is the name of one formal parameter.

17 args, word, letter

18 This line contains an actual parameter (argument).

19 15, 20, 22, 27-28, 32, 34, 36, 39, 51

20 This is one of those actual parameters (arguments)

21 System.in, any of the output, count, letter, “Y”, pos

22 T/F, An if statement must contain an else clause.

23 F

24 This line contains a boolean expression.

25 18, 25, 39, 49, 51

26 This is a boolean expression that will evaluate to true if an integer, num1, is evenly divisible by 5 and false otherwise. This is a boolean expressi o n that will evaluate to This expression evaluates to true if an integer, num1, is evenly divisible by 5 and false otherwise.

27 num1 % 5 == 0

28 This is a boolean expression that will evaluate to true if the String, word, is “CS 139” exactly.

29 word.equals(“CS 139”)

30 &&, ||, and ! are examples of this.

31 Logical operators

32 This line contains a loop decision.

33 18, 25, 49

34 This line contains a loop update.

35 40,42, 29, 49

36 This is one update statement.

37 pos++; cont = true (false); letterStr = keyboard.nextLine();

38 If we had the word, “Jeopardy”, and the letter “z”, how many times would the loop body in countLetter execute.

39 8 times, once for each letter.

40 This kind of loop is a post condition loop.

41 do while

42 You have a random number generator declared as rand. This statement will generate a number in the range of 13 – 22.

43 rand.nextInt(10) + 13

44 This line contains the declaration of a reference type variable.

45 7, 8, 9, 10, (5), 45

46 This statement instantiates a reference object.

47 keyboard = new Scanner(System.in);

48 This is a primitive literal found in the file.

49 0, true, false, 1

50 These are two of the three variables local to the countLetter method.

51 word, letter, count, pos


Download ppt "200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 200 300 400 500 100 Expressions Methods if else Statements Loops Potpourri."

Similar presentations


Ads by Google