tailieunhanh - Lecture Java: Chapter 8

Lecture Java: Chapter 8 (Arrays) focuses on array declaration and use, bounds checking and capacity, arrays that store object references, variable length parameter lists, multidimensional arrays, the ArrayList class, polygons and polylines, mouse events and keyboard events. | Copyright © 2012 Pearson Education, Inc. Chapter 8 Arrays Java Software Solutions Foundations of Program Design Seventh Edition John Lewis William Loftus Arrays Arrays are objects that help us organize large amounts of information Chapter 8 focuses on: array declaration and use bounds checking and capacity arrays that store object references variable length parameter lists multidimensional arrays the ArrayList class polygons and polylines mouse events and keyboard events Copyright © 2012 Pearson Education, Inc. Outline Declaring and Using Arrays Arrays of Objects Variable Length Parameter Lists Two-Dimensional Arrays Polygons and Polylines Mouse Events and Key Events Copyright © 2012 Pearson Education, Inc. Arrays The ArrayList class, introduced in Chapter 5, is used to organize a list of objects It is a class in the Java API An array is a programming language construct used to organize a list of objects It has special syntax to access elements As its name implies, the ArrayList class | Copyright © 2012 Pearson Education, Inc. Chapter 8 Arrays Java Software Solutions Foundations of Program Design Seventh Edition John Lewis William Loftus Arrays Arrays are objects that help us organize large amounts of information Chapter 8 focuses on: array declaration and use bounds checking and capacity arrays that store object references variable length parameter lists multidimensional arrays the ArrayList class polygons and polylines mouse events and keyboard events Copyright © 2012 Pearson Education, Inc. Outline Declaring and Using Arrays Arrays of Objects Variable Length Parameter Lists Two-Dimensional Arrays Polygons and Polylines Mouse Events and Key Events Copyright © 2012 Pearson Education, Inc. Arrays The ArrayList class, introduced in Chapter 5, is used to organize a list of objects It is a class in the Java API An array is a programming language construct used to organize a list of objects It has special syntax to access elements As its name implies, the ArrayList class uses an array internally to manage the list of objects Copyright © 2012 Pearson Education, Inc. Arrays An array is an ordered list of values: 0 1 2 3 4 5 6 7 8 9 79 87 94 82 67 98 87 81 74 91 An array of size N is indexed from zero to N-1 scores The entire array has a single name Each value has a numeric index This array holds 10 values that are indexed from 0 to 9 Copyright © 2012 Pearson Education, Inc. Arrays A particular value in an array is referenced using the array name followed by the index in brackets For example, the expression scores[2] refers to the value 94 (the 3rd value in the array) That expression represents a place to store a single integer and can be used wherever an integer variable can be used Copyright © 2012 Pearson Education, Inc. Arrays For example, an array element can be assigned a value, printed, or used in a calculation: scores[2] = 89; scores[first] = scores[first] + 2; mean = (scores[0] + scores[1])/2; ("Top = " + scores[5]); pick = .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.