Download presentation
Presentation is loading. Please wait.
1
Computer Science Review
Sasha.P & Kevin.L
2
Arrays! Arrays are used to make multiple GUI and variables at once.
An example would be: String [ ] s = new String [X]; ^ ^ ^ Type Name # of value
3
Example of how it is used.
//Declare the array String [ ] days_week; days_week = new String [7] ; //Assign data to each box/slot of the defined array days_week [0] = “Monday” ; days_week [1] = “Tuesday” ; days_week [2] = “Wednesday” ; days_week [3] = “Thursday” ; days_week [4] = “Friday” ; days_week [5] = “Saturday” ; days_week [6] = “Sunday” ; System.out.printIn(days_week[1] + “ we have Java class. “) ;
4
Two Dimensional Arrays!
Similar to normal arrays, two dimensional arrays use boxes arranged in rows and columns to store data. In this case require 2 numbers, a coordinate pair, to identify each slot/box instead of one to allow the programmer to have more elaborate data storage. This allows accuracy to the program whilst making the program in a grid-like formation. An example would be: String [ ][ ] s = new String [X][Y]; ^ ^ ^ ^ Type Name # of coordinates
5
How it works Column 1 Column 2 Column 3 Column 4 Row 1 X [ 0 ] [ 0 ]
6
How to create 2 dimensional arrays on practice
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.