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;
20 Cards in this Set
- Front
- Back
Arrays definition?
|
Arrays are a way to collect similar primitive types or similar classes together.
|
|
Steps to declare arrays?
|
1) Declare a variable to hold Array
2) Declare a new array object and assign it to the array variable. 3) Store information in the array |
|
How to Declare a variable to hold Array?
|
Use [ ] to declare array variable and differentiate from a regular variable.
ex: String [ ] request ; |
|
How to Declare a new array object?
|
1) Use the 'new' operator
2) Initialize the content of the array ex: Integer [ ] requests = new integer [3] ; |
|
How to Store information in the array:
|
ex: Integer [ ] testScore = new integer [41]
testScore [40] = 920 ; We set the 41st slot in the array to a value of 920.Value is checked against array index range. |
|
when Changing Array object value do we copy that value ????
|
When assigning a value to an array object we are only referencing and not copying that value
|
|
Does java support multi-dimensional arrays???
If not what does it support then?? |
No, but Java supports making an array of arrays.
|
|
What are block statements?
|
Are statements bounded by braces { } and executed within these boundaries.
|
|
if Conditional statement definition?
When is it used? |
Is a decision making mechanism, it executed only when a certain condition has been met (Boolean condition), bounded by { }
|
|
Switch conditional statement definition?
When is it used? |
The practice of testing a variable against a value, if it does not match it ,it will be tested against another one until a match is found.
|
|
Switch Example
|
switch variableName {
case 'A': system.out.println (""); break case 'b': then have default:" to exit" |
|
for Loops definition and when to use?
|
Used to repeat a statement until a condition is met
|
|
example of a for loop
|
for (initialization ; test ;increment){
Statement; } |
|
while and do loops
|
for and while and do loops are similar choosing which one depends on programing style.
|
|
do-while Loop?
|
Similar to while Loop but the condition is executed at least once before testing for true or false.
|
|
how to break out of a Loop
|
using the break command when the condition is fulfilled.
|
|
Label Loops?
|
when loops has a label telling them where to start executing conditions again. Could be used to execute out of the loop if needed.they are marked with a colon :
|
|
Example Labeled Loop
|
out:
for (int i = 0 ; i<10 ; i++){ break out; } |
|
Conditional Statement Def.?
|
Is an expression that returns a Boolean value that in return chooses a value based on the true or false.
|
|
example of a Conditional Statement?
|
int ourBestScore = myScore > yourScore ? myScore : yourScore
If true will return myScore if false will return your Score |