Download presentation
Presentation is loading. Please wait.
Published byGodwin Cameron Modified over 9 years ago
1
SEEM3460 Tutorial Arrays in Java
2
Arrays in Java Initialization array1 = new SomeClass[ARRAY_SIZE]; array1 = {element1, element2, …}; Object as elements Example: Tunes.java + CDCollection.java + CD.java Array as parameter public void SomeMethod(int[] arr) {…} Use System.arraycopy() and.length
3
Exercise Create an extra CD constructor for “Empty” Create a class CDShelf with: an integer variable called “rowcount” an integer variable called “rowsize” a two-dimensional array for holding “rowsize”x“rowcount” CDs a constructor to fill shelf with “Empty” a method to list all CDs of a row a method to list all CDs of the shelf a method to insert CD to specific position a method to replace a row of CDs a method to calculate row total price a method to calculate shelf total price
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.