Shared Flashcard Set

Details

CS 1150 Quiz #2
Chapters 1-6
32
Computer Science
Undergraduate 2
10/04/2011

Additional Computer Science Flashcards

 


 

Cards

Term
Java API
Definition
Application program interface. Contains predefined classes and interfaces for developing Java programs.
Term
JDK
Definition
Java Development Toolkit. A set of separate programs, each invoked from a command line, for developing and testing Java programs.
Term
IDE
Definition
Integrated development environment. A software application that normally consists of a source code editor, compiler, build automation tools, and a debugger.
Term
Java Virtual Machine
Definition
A specification for software which interprets Java programs that have been compiled into byte-codes, and usually stored in a ".class" file.
Term
Display message in dialog box
Definition
import javax.swing.JOptionPane;
Main method
JOptionPane.showMessageDialog(null, "Message dialog");
Term
Main method
Definition
public class Class {
public static void main(String[] args) {
Term
Reading input from the console
Definition
import java.util.Scanner;
Main method
Scanner input = new Scanner(System.in);
Term
Naming constants
Definition
final datatype CONSTANT = VALUE;
Term
Data types from smallest to largest
Definition
byte
short
int
long
float
double
Term
Shorthand operators
Definition
i = i + 8 i+=8
i-=
i*=
i/=
i%=
Term
Numeric type conversion
Definition
System.out.println((int)1.7) displays 1
System.out.println((double)1/2) displays 0.5
Term
Character data type
Definition
char is used to represent a single character.
char letter = 'A';
char numChar = '4';
Term
Increment/decrement character data type
Definition
char ch = 'a';
System.out.println(++ch);
displays 'b'
Term
Getting input from input dialogs
Definition
String variableNameString = JOptionPane.showInputDialog("Input dialog");
datatype variableName = Datatype.parseDatatype(variableNameString);
Term
Boolean variables
Definition
Hold either 'true' or 'false'
Term
Logical/Boolean Operators
Definition
! not
&& and
|| or
^ exclusive or
Term
One way if statement
Definition
if (boolean expression) {
statement;
}
Term
Two way if statement
Definition
if (boolean exp.) {
statements;
}
else {
statements;
}
Term
Nested if statements
Definition
if (i>k) {
if (j>k)
System.out.print("i & j > k");
}
else
System.out.print("i<=k");
Term
Switch statements
Definition
switch (switch expression) {
case value1: statement1;
break;
case value2: statement2;
break;
default: default statement;
}
Term
While loop
Definition
executes the statements in the loop body until the loop continuation condition is no longer true.
while (loop continuation condition) {
statements;
}
Term
Do-while loop
Definition
The loop body is executed first. Then the loop continuation condition is evaluated and if it's true the loop body is executed again; if it's false the loop ends.
do {
statements;
} while (loop continuation condition);
Term
For loop
Definition
Performs initial action once, then repeatedly executes the statements in the loop body, and performs an action after each iteration
for (initial action; loop continuation condition; action after each iteration){
statement;
}
Term
Nested for loops
Definition
Each time the outer loop is repeated, the inner loops are reentered and started anew.
Term
Break
Definition
Immediately terminates the loop.
Term
Continue
Definition
Ends the current iteration.
Term
Defining a method
Definition
modifier returnValueType methodName(list of parameters) {
ex:
public static int max(int num1, int num2){
Term
Calling a method
Definition
int larger = max(3,4);
or
System.out.println(max(3,4));
Term
Scope of a variable
Definition
The part of the program where the variable can be referenced. Starts from its declaration and continues to the end of the block that contains the variable.
Term
Creating Arrays
Definition
elementType arrayRefVar = new elementType[arraySize];

ex:
double[] myList = new double[10];
Term
Initializing an array
Definition
double[] my List = {4, 2, 6, 8, 9};
Term
Passing arrays to methods
Definition
public static void printArray(int[] array) { for (int i=0; i
Supporting users have an ad free experience!