• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/57

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

57 Cards in this Set

  • Front
  • Back

array

an object that can store a group of values all of the same type

size declarator

number inside the brackets when you declare an array

once an array is created

the size of the array can not be changed

subscript

used as an index to pinpoint a specific element within an array

bounds checking occurs at

runtime

if an array is out of bounds

an exception is thrown and immediately terminates

length field

contains the number of elements in an array

largest subscript

in an array is length-1

enhanced for loop

designed to iterate once for every element in an array, each time the loop iterates it copies an array element to a variable

for(int val: Numbers)


System.out.println(val);


what is the purpose of val?

it receives the value of the array element temporarily each time the loop iterates


array1 == array2

does not copy the array, makes a copy of the address that is stored in array 1

reference copy

when two variables reference the same array

to copy an array

you need to copy each individual element of the array

when passing an array to a method

it is passed just as an object is, actual array is not passed but a reference to the array is

ture or false, arr1 == arr2

always will be false because they have 2 different memory addresses

when a partially filled array is passedc as an argument to a method

the variable that holds the count of items must also be passed as an argument

an array of string objects

is really an array of references to string objects

sequential search algorithm

compares each element w/ the value being searched for and stops when the value is found

2d array

an array of arrays composed of rows and columns

int[][] numbers = { {1, 2, 3} {4, 5, 6} {7, 8, 9}};


numbers.length equals?

3( # of rows)

ragged array

when rows of a 2d array are different lengths

selection sort algorithm

smallest value in an array is located and moved to element 0, switching with the element that was stored there

ArrayList

an object that is an array of objects

to add items to arraylist

arraylist.add("James");

to get the number of items stored in arraylist

arraylist.size();

default capacity of arraylist

10, without changing it manually

given an array named x, a reference to x[x.length]

causes an indexoutofboundsexception

how many bytes if each reference is 4?


int[] a = new int[10];


int[b] = a;

48

an enhanced for loop

cannot be used to change array elements

arraylist size and capacity

size <= capacity

to reference the last element of arraylist

list.get(list.size() - 1)

Wrapper class

a class that is wrapped around a primitive data type and allows you to create objects instead of variables

immutable

once an object is created value can not be changed

tokenizing

the process of breaking a string down into components(tokens)

delimeter

character that separates tokens

split

tokenizes a string and returns an array of string objects

input file

file that a program reads data from, serves as input to the program

output file

file that a program writes data to, program stores output

text file

contains data that has been encoded as tet using unicode

binary file

contains data that has not been converted to text

printWriter

a class that allows you to open a file for writing

printWriter outputFile = new PrintWriter("Data.txt");

passes the name of the file you want to open

if the file you are opening already exists

it will be erased an an empty file with the same name will be created

outputFile.close();

closes file when done writing, writes any unsaved data remaining in the file buffer

buffer

a small holding section of memory when it is filled all the memory that is stored there is written to the file

exception

a signal indicating that the program cannot continue until the unexpected even has been dealt with

fileWrtier

used to append data to an existing file

binary file

a file that contains data that is not readable in text form is called a(n)

printwriter

The best class to use for writing a file is

Every output file should be explicitly closed after the last write operation so that

the buffer will be written out to the file

IOException

When an error occurs during file output, the program will thrown a(n)

PrintWriter output = new PrintWriter(new FileWriter(“filename.txt”, true));

The correct way to open a file for extension (to append to the file) is:

/home/username/myfile.txt

The correct form in which to specify a file on a Unix system is

C:\\Users\\username\\myfile.txt

the correct form in which to specify a file on a Windows system is

The correct way to open a file to be read using Scanner is

Scanner input = new Scanner(new File(“filename.txt”));

if (inputFile.exists()) {…}

The Scanner method to detect whether a file exists is

while (inputFile.hasNext()) {…}

The correct way to setup an input loop with Scanner is