Arrays Loops. Java Core презентация




Слайды и текст этой презентации
Слайд 1
Описание слайда:
Arrays Loops Java Core


Слайд 2
Описание слайда:
Agenda Arrays While For Break, continue Search item in the array Sorting Practical tasks

Слайд 3
Описание слайда:
Array An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. String dayWeek[]= new String[7]; String[] month; month = new String[12]; Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. dayWeek[0] = “Monday”; month[11] = “December”;

Слайд 4
Описание слайда:
Array int month_days[ ] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} ; int month_days[ ] = new int[12]; month_days[0] = 31; month_days[1] = 28; // . . . month_days[11] = 31; int n = month_days.length; // n = 12 System.out.println(month); //[I@659e0bfd Need override toString(); or use Arrays.toString(month);

Слайд 5
Описание слайда:
Array char twod1[ ][ ]= new char[3][4]; char[ ][ ] twod2= new char[3][4]; double m[ ][ ]= {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}, {12, 13, 14, 15}}; int twoD[ ][ ]= new int [4][ ]; twoD[0]= new int [1]; twoD[1]= new int [2]; twoD[2]= new int [3]; twoD[3]= new int [4]; int[ ][ ] irregular={{1},{2,3,4},{5},{6,7}}; // Rows not equal

Слайд 6
Описание слайда:
while

Слайд 7
Описание слайда:
do while

Слайд 8
Описание слайда:
for The for statement provides a compact way to iterate over a range of values.

Слайд 9
Описание слайда:
for Another representation of statement for

Слайд 10
Описание слайда:
break The break statement terminates the for, while and do-while loop.

Слайд 11
Описание слайда:
continue The continue statement skips the current iteration the for, while and do-while loop.

Слайд 12
Описание слайда:
Sum, product, amount There’s an array int[] arr = {2, -5, 7, -4, 8}; What will results after running next code?

Слайд 13
Описание слайда:
Minimum, maximum ...

Слайд 14
Описание слайда:
Sorting

Слайд 15
Описание слайда:
Practical tasks Create an array of ten integers. Display  the biggest of these numbers; the sum of positive numbers in the array; the amount of negative numbers in the array.     What values there are more: negative or positive? Create a class Employee with fields name, department number, salary. Create five objects of class Employee. Display all employees of a certain department (enter department number in the console); arrange workers by the field salary in descending order.

Слайд 16
Описание слайда:
HomeWork (online course) UDEMY course "Java Tutorial for Complete Beginners": https://www.udemy.com/java-tutorial/ Complete lessons 8, 9, 12, 14 - 16:

Слайд 17
Описание слайда:
Homework Ask user to enter the number of month. Read the value and write the amount of days in this month (create array with amount days of each month). Enter 10 integer numbers. Calculate the sum of first 5 elements if they are positive or product of last 5 element in the other case. Enter 5 integer numbers. Find position of second positive number; minimum and its position in the array. Organize entering integers until the first negative number. Count the product of all entered even numbers. Create class Car with fields type, year of production and engine capacity. Create and initialize four instances of class Car. Display cars certain model year (enter year in the console); ordered by the field year.

Слайд 18
Описание слайда:
THE END


Скачать презентацию на тему Arrays Loops. Java Core можно ниже:

Похожие презентации