Study your flashcards anywhere!

Download the official Cram app for free >

  • 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

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/44

Click to flip

44 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)
One of the variables of a class template which may have a different value for each object of that class; ________ _________ hold the state of an object.
instance variables
Name the 5 arithmetic operators:
+ additive operator (also used for String concatenation)
- subtraction operator
* multiplication operator
/ division operator
% remainder operator
Define "short-circuting" behavior in relationship to conditional operators(&& and ||)
The second operand(expression) is evaluated only if needed.
A _________ forms a complete unit of execution. Here are some examples:

aValue = 8933.234; // assignment

aValue++; // increment

System.out.println("Hello World!"); // method invocation

Bicycle myBike = new Bicycle(); // object creation

double aValue = 8933.234; //declaration
statement
What is this code called and what does it do?

switch (expression) {
case cond1: code_block_1;
case cond2: code_block_2;
...
case condn: code_block_n;
default: code_block_default;
}
The switch statement allows for any number of possible execution paths.
A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer.
A _____ ________ is any field declared with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated.
class variable
What does a break statement do?
An unlabeled break statement terminates the innermost switch, for, while, or do-while statement, passing control to the next line of programming following the current loop. A labeled break terminates an outer statement.
* The break statement should normally be used at the end of each case statement of a switch statement.

* In other contexts, the break statement is never necessary; it can always be elimitated by rearranging the code.

* Use of the break statement violates the rules of structured programming.
Name the 6 Equality and Relational Operators:
== equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
How does this code work?

result = someCondition ? value1 : value2;
If someCondition is true, assign the value of value1 to result. Otherwise, assign the value of value2 to result.
This operator is also known as the ternary operator(?:) because it uses three operands.
A _____ is the blueprint from which individual objects are created.
class
A _____ is a group of zero or more statements between balanced braces and can be used anywhere a single statement is allowed.
block
The ____ data type is an 8-bit integer number. It has a minimum value of -128 and a maximum value of 127.
byte
This data type is one of the eight primitive data types.
The while statement continually executes a block of statements while a particular condition is true. How is its syntax expressed?
while (expression)
{statement(s)}
You can implement an infinite loop using the while statement as follows:

while (true)
{
// your code goes here
}
Similar to how an object stores its state in fields, a method will often store its temporary state in ______ ________. These are only visible to the methods in which they are declared; they are not accessible from the rest of the class.
local variables
The _____ data type is a single-precision 32-bit decimal number.This data type should never be used for precise values, such as currency.
float
This data type is one of the eight primitive data types.
The ________ statement skips the current iteration of a for, while , or do-while loop. The unlabeled form skips to the end of the innermost loop's body and evaluates the boolean expression that controls the loop.
continue
What does this code do?

if(value1 == 1)&&(value2 == 2)
System.out.println(value1 + value2);
If value1 is equal to 1 AND value2 is equal to 2 then the program will print out the value of both added together: "3"
What are the 5 Unary Operators?
+ Unary Plus Operator
- Unary Minus Operator
++ Increment Operator
-- Decrement Operator
! Logical Compliment Operator
#1)indicates positive value
#2)negates an expression
#3)increments a value by 1
#4)decrements a value by 1
#5)inverts the value of a boolean
The first element in an array, accessed by its numerical index, begins with what number?
0
It is not the number 1.
Object-oriented programming allows classes to ______ commonly used state and behavior from other classes.
inherit
What code syntax is used for an if-then statement?
if(condition)
{
statement;
}
The _____ data type is a 16-bit integer number. It has a minimum value of -32,768 and a maximum value of 32,767.
short
This data type is one of the eight primitive data types.
What is the difference between a while statement and a do-while statement?
The do-while evaluates its expression at the bottom of the loop instead of the top. Therefore, the statements within the do block are always executed at least once. The while statement evaluates its expression at the beginning of each loop.
The syntax for a do-while statement is:

do {
statement(s)
} while (expression);
The data type of a returned value must match the type of the method's declared return value. When a method is declared ____, use the form of return that doesn't return a value.
void
The ______ data type is a double-precision 64-bit decimal number. This data type should never be used for precise values, such as currency.
double
This data type is one of the eight primitive data types.
An ______ is a container object that holds a number of values of a single type.
array
Note: Each element(value) is accessed by its numerical index. Numbering begins with 0. The 9th element, for example, would therefore be accessed at index 8.
The ______ statement exits from the current method, and control flow returns to where the method was invoked.
return
What does this code do?

if(value1 == 1)||(value2 == 2)
System.out.println("Hello");
If value1 is equal to 1 OR value2 is equal to 2 then the program will print out "Hello"
An __________ is a construct made up of variables, operators, and method invocations, which are constructed according to the syntax of the language, that evaluates to a single value.
expression
A Java _________ allows unrelated objects to interact with one another. It defines a set of methods but does not implement them.

Classes that implement this agree to implement all of the methods defined in it, thereby agreeing to certain behavior.
interface
You can't specify static methods in one of these.
What is the range of this arrays index?

arrayName = new int[10];
0 - 9
The first element in an array is not 1.
What code syntax is used for an if-then-else statement?
if(condition)
{statement1;}
else
{statement2;}
The ___ data type is a 32-bit integer number. It is the most common type.
int
This data type is one of the eight primitive data types.
What is the syntax of a for statement?
for (initialization; termination; increment) {
statement(s)
}
The three expressions of the for loop are optional; an infinite loop can be created as follows:

for ( ; ; ) { // infinite loop

// your code goes here
}
Object-oriented programming allows classes to inherit commonly used state and behavior from other classes.
The syntax for creating a subclass is simple. At the beginning of your class declaration, use the _______ keyword, followed by the name of the superclass.
extends
The _______ data type has only two possible values: true and false.
boolean
This data type is one of the eight primitive data types.
An ______ is a software bundle of related state and behavior.
object
These are often used to model the real-world things that you find in everyday life.
A _______ is a namespace that organizes a set of related classes and interfaces.
package
The Java platform provides an enormous class library (of these) suitable for use in your own applications. This library is known as the "Application Programming Interface", or "API" for short.
How many values does this array hold?

double[] anArrayOfDoubles;
an unspecified number
The ____ data type is a 64-bit integer. It has a larger range than the int type.
long
This data type is one of the eight primitive data types.
As an example: Bicycle would be a __________ with MountainBike, RoadBike, and TandemBike being three of it's ________.
superclass, subclasses
The ____ data type is a single 16-bit Unicode character.
char
This data type is one of the eight primitive data types.
What is the name of this kind of array?

String[][] names = {{"Mr. ", "Mrs. ", "Ms. "},{"Smith", "Jones"}};
multidimensional array
To return a value, simply put the value (or an expression that calculates the value) after the ______ keyword.
return