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;
47 Cards in this Set
- Front
- Back
Array-
|
A sequence of values of the same data type
|
|
Array element?
|
one value of the array
|
|
Elements idenetified by what postion?
|
index
|
|
Syntax for Declaring an array?
|
data type [length] array-variable-name;
int[] data; |
|
syntax for declaring and instantiating an array?
|
data type [length] array-variable-name = new data type [length]
|
|
syntax using an individual element of an array?
|
data[index position];
like data[0]; |
|
When array first created its values intitalize to what?
numeric intitializes to ? boolean? object references? |
0
false null |
|
To determine the number of elements in an array use what field?
|
length field
data.length |
|
The lenght of an array is always be?
|
one greater then the index
|
|
Syntac for Declaring and instantiating an ArrayList of objects?
|
ArrayList <bankAccounts> accounts= new ArrayList <bankAccounts>;
ArrayList<objecType> listName = new ArrayList<objectType>; |
|
Add method does what?
|
adds a new element to the ArrayList
data[10] add one now you have data[11] and index 0-10 |
|
size() method does what?
|
determine the number of elements in the array list
|
|
syntax for add method
|
data.add(new data(the old number of the index));
|
|
Wrapper classes?
|
used to treat primitive type values as objects
|
|
auto-boxing?
|
automatic conversion between primitive types and the corresponding wrapper classes
|
|
syntax for Enhanced For Loops?
|
for(int data : array or arraylist name)
|
|
Enhanced for loop does what?
|
variable name is assigned one by one to each element in the array or array list.
then you use the variable name to manipulate the actual element within the loop body |
|
Two-demensional arrays?
|
ROWS ARE VERTICAL
COLUMNS ARE HORIZONTAL |
|
syntax for declaring and instantiating a two-demensional array?
|
data type [][] data = new data type[row][column];
|
|
How to get the length of rows for 2 demensional arrays?
|
data.length gives rows
|
|
How to get the length of columns for 2 demensional arrays?
|
data [i].length gives count of columns in row i
|
|
coping array variables what does it do?
|
only copies the pointers to the array object; it does not create a new array.
|
|
clone methods what does it return and what you have to do?
|
clone method gives a true copy and returns type object, so you need to cast it to the same type as the original array
|
|
arraycopy method does what?
|
copyies the elements from one array to another
|
|
concept classes?
|
should represent a single concept from the problem domain
|
|
actor classes?
|
do some kind of work for you, such as scanner or random classes
|
|
utiliy classes?
|
contain no objects, but only a set of static methods and constants
|
|
runnable classes?
|
contain only main methods
|
|
Static Methods?
|
a method that is not invoked on an object
|
|
Static Fields
|
belongs to the class, not to an object of the class
|
|
Static Fields should always be declared as what?
|
Private
|
|
class instance variables have what scope?
|
class scope
|
|
local variables declaed within a mehtods have what scope?
|
method scope
|
|
local variables declaed within a code block have what scope?
|
block scope
|
|
parameter variables( which are declared in the method header) have what scope
|
method scope
|
|
when do you use this for scope
|
when you are overlaping scope
|
|
packages are used for?
|
advoiding class name clashes
|
|
how tm ospecify if a class belongs to a package?
|
in the first line write
package package-name; |
|
how to import all classes?
|
use *like
import package-name.*; |
|
how to import JOptionPane class?
|
import javax.swing.JOtionPane;
|
|
how to import random class?
|
import java.util.random;
|
|
how to import scanner class?
|
import java.until.Scanner;
|
|
how to import Arraylist class
|
import java.util.ArrayList<E>;
|
|
how to import arrays
|
import java.util.arrays;
|
|
how to import math class?
|
import java.lang.Math;
|
|
how to import rectangle class?
|
import java.awt.Rectangle;
|
|
Decaling a method names getData that returns String array?
|
public String[] getData()
|