Chapter 2
Program Control Statements. Loops. Methods. Arrays.
Objectives:
After completing the session, you can:
- explain the following terms: program control statements, loops, signature of a method, formal and actual parameters, types of methods, a return statement;
- control program flow using
if
statements and nestedif
statements; - choose the appropriate repetition control statement for a given task and implement it in a program using
while
,do-while
orfor
(nested) statements; - define simple static methods with formal parameters;
- invoke static methods with actual parameters;
- define methods with return value;
- use method overloading;
- describe the essence of arrays in programming;
- declare a one- and multidimensional array;
- declare, create, and initialize an one- and multidimensional array, using array initializer;
- access array elements through indices;
- simplify programming using the for each loops;
- retrieve data from the command line and convert the data into an appropriate data type.
Topics
- 2.1 Conditional statements
- 2.2 Loops
- Static methods (or class methods)
- Arrays
- 2.8 Command-line arguments
- 2.9 Tasks
NB! Watch the video in youtube if you need the subtitles!
Alternative materials
- in English:
- H. Schildt. Java - The Complete Reference: Chapters: 3 (arrays), 5, 7
- A. B. Downey and C. Mayfield. Think Java: How to Think Like a Computer Scientist: Chapter 4, 6, 8
- in Estonian: here
- in Russian:
- Г. Шилдт. Java 8. Полное руководство: Chapters: 3 (arrays), 5, 7
- Videos 8- 10