





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An outline for the arrays and collections topic covered in the cop3330 course at the university of central florida during the fall 2006 semester. The outline includes information on arrays, iterators, searching and sorting, and collections such as arraylist and vector. It also covers methods and the compareto function.
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






H. Schwartz
COP 3330 – Fall 2006
COP 3330 – Fall 2006
COP 3330 – Fall 2006
int[] numbers = new int[10];//creates a new array of integers String[] sentences = new String[5]; //creates an array of refrences to Strings //the Strings themselves have not been created yet
COP 3330 – Fall 2006
File []files = new File[3];//creates an array of files //create File objects for given files / directories files[0] = new File(“something.txt”); files[1] = new File(“/home/user”); files[2] = new File(“/home/user/oop.txt”);
//perform File instance methods on objects: if (files[0].exists()) System.out.prinln(“it exists”); String []fNames = files[1].list();//lists contents on directory files[2].setLastModified(123154623);
COP 3330 – Fall 2006
//computes how many integers are greater than 50 in intAr int numGreater = 0; for (int i = 0; i < intAr.length; i++){ if (intAr[i] > 50) numGreater++; }
//equivalent: for (int num: intAr){ if (num > 50) numGreater++; }
COP 3330 – Fall 2006
COP 3330 – Fall 2006
COP 3330 – Fall 2006
COP 3330 – Fall 2006
public class UsesAnArrayList{
private ArrayList
public UsesAnArrayList(){ //constructor intList = new ArrayList
Tangent: Java Number classes
COP 3330 – Fall 2006
COP 3330 – Fall 2006