Master java

¡Supera tus tareas y exámenes ahora con Quizwiz!

I/O

A way to get data into and out of our program

In all but rare cases, loops must contain within themselves

A way to terminate

!=

Not Equal

Two primary sections of memory JVM creates when a Java program is executed?

Heap and stack

What does string [] array = "Hello,World".split(","); do?

Hello on line 1 and World on line 2

memory

Holds data for the computer to process, and holds the result of the computer's intermediate calculations.

CH12: FileNotFoundException inherits from ________.

IOException

CH13: You can pass an instance of this class to the JLabel constructor if you want to display an image in the label.

ImageIcon

CH12: The numeric wrapper classes' "parse" methods all throw an exception of this type.

NumberFormatException

In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in); System.out.print("Enter a number: "); int number = keyboard.nextInt(); while (number < 100 || number > 500) { System.out.print("Enter another number: "); number = keyboard.nextInt(); }

Numbers in the range 100 through 500

heap sort

O(nlog2n) comparisons; consists of two phases, the construction and extraction phase

Documentation Comment

A comment in a source file that can be automatically extracted into the program documentation by a program such as javadoc

<

Less than

Pseudorandom

Not truly random, but like random

Breakpoint

A point in a program, specified in a debugger, at which the debugger stops executing the program and lets the user inspect the program state

stack.

Memory space for storing call hierarchy and local variables.

static method

Method belongs to class and can be called without instantiating an object.

Static methods

Method not associated with any object

User Input

Methods created/used to receive data from a user.

syntax error

Mistakes detected by the compiler such as forgetting a semicolon.

Short circuit evaluation

A process for determining the result of a Boolean expression where the left operand is evaluated first. If the result of the entire expression can be determined by the left operand, no other operands are evaluated.

Embedded System

A processor, software, and supporting circuitry that is included in a device other than a computer

Editor

A program for writing and modifying text files

Parser

A program that reads a document, that checks whether it is syntactically correct, and takes some action as it processes the document.

interpreter

A program that runs code like a computer

robust

A program that supports development of programs that do not overwrite memory.

compiler

A program that translate a high-level-language program into a program in a simpler language that the computer and more or less directly understand.

Class

A programmer-defined data type.

Bug

A programming error

Conditional Control Structure

A statement that branches program flow depending on a condition. Also called a decision structure.

break statement

A statement that terminates a loop or switch statement

assignment statement

A statement using the assignment operator.

field

A variable that belongs to the entire class (not just a method).

Local variable

A variable that has a scope from the point of declaration to then end of the block in which they are declared

event listener

object that includes a method that gets executed in response to generated events

What are the three parts of a method call?

objectname.methodname.parameters

event

occurs when the user interacts with a GUI object

lenght

of a character is 0

off-by-one error

one fewer iteration or one too many

What is a predicate method?

one that returns a boolean value

type conversation

only requires one conversation;

abstract method

only the method header but no body

Unary operator

operator that uses only one operand.

binary operator

operators that have two operands

unary operators

operators that only have one operand

||

or operator, control statement is executed when at least one condition is true

Inheritance

organization of relevant classes into an hierarchy of parent and child classes; inherit some common base of data members and method from the parent class; maintainability, readability, extendability

CH11: Abstract methods must be ________.

overridden

What are the two parts of a class name?

package name and class name (java.awt.Rectangle)

How to convert a string to a number: two methods?

parseInt or parseDouble

procedure

performs an action but doesn't return anything;

Cast operator

performs an explicit-type conversion; it is created by placing the desired result type in parentheses before the expression to be converted.

ClassName objectName = new ClassName(arguments);

what is the syntax to create an object from a class

override

when a child class has the same method name as the parent class, the child's method body will be implemented

implicit type coercion

when a value of one data type is automatically treated as another data type

sample run

when you compile and excute this program

java api documentation

where can you find documentation of the classes and methods?

What does string1==string2 test for?

whether string1 and string2 refer to the same location in memory

semantic rules

which determine the meaning of the instructions. the programming languages rules symbols special words and their meaning

Which of the following are pre-test loops:

while, for

continue statement

will cause the currently executing iteration of a loop to terminate and the next iteration will begin.

short hand of x=x+y

x+=y

increment by 1

x=x++;

Can the Scanner class be used with input other than keyboard?

yes

Is Java case sensitive?

yes

Should a constructor initialize every instance variable?

yes

Is this legal: double a, b;

yes.

Constant -Naming

Start with upper case letter and continue with all upper case letters, usually a name that denotes the data being stores.

Class -naming

Start with upper case letter, then camel-hump notation, usually a name that denotes the item being defined.

A simple command that causes something to happen

Statement

! ( NOT )

This operator reverses the truth of a boolean expression. if ( x !<) ...

When you open a file with the PrintWriter class, the class can potentially throw an IOException True or False

True

T/F Inheritance is intended to make things more specific.

True, = means store a value in a certain memory location.

T/F Operators represent actions, not states.

True, = means store a value in a certain memory location.

T/F Java allows single extension.

True.

Bounds error

Trying to access an array element that is outside the legal range

Variable - Strongly Typed

Variable must be declared with specific data type and explicit conversion is the only way to override the initial data type.

parameter

Variable passed to a method that provides more information for the method.

Variable - Weekly Typed

Variables defined as one type of data are allowed to be treated as another type of data within the program.

Function - Parameter

Variables defined in the heading of the function, if required, that allow input values to be sent into the function in its calling statement, if required.

Procedure - Parameter

Variables defined in the heading of the procedure, if required, that allow input values to be sent into the procedure upon it being called.

Function - Argument

Variables or values passed to the function in its calling statement,if required.

Procedure - Argument

Variables or values passed to the procedure in its calling statement, if required.

Variable - Local

Visible only where they are defined.

Variable - Global

Visible to any part of a program.

Primitive type

a simple data type. Java's primitive types are byte, short, int, long, float, double, char, and boolean.

Unifying type

a single data type to which all operands in an expression are converted.

What is simple inheritance?

a single extension.

Keyboard buffer

a small area of memory where keystrokes are stored before they are retrieved into a program.

What three things can be a whitespace?

a space, the end of the line, or a tab

Variable declaration

a statement that reserves a named memory location.

string literal

a string such as hello

null

a string tht contains no characters

Camel casing

a style in which an identifier begins with a lowercase letter and subsequent words within the identifier are capitalized.

Balanced tree

a tree in which each subtree has the property that the number of descendants to the left is approximately the same as the number of descendants to the right

Token

a unit of data; the Scanner class separates input into these.

Token

a unit of data; the Scanner class separates input into tokens.

Input dialog box

asks a question and provides a text field in which the user can enter a response.

CH12: This is a section of code that gracefully responds to exceptions.

exception handler

checked exception

exception that is check at compile time

exception propagator

exception thrower that does NOT include a matching catch block; passes on the exception to another method

exception catcher

exception thrower that includes a matching catch block for the thrown exception

exchange sort

exchange or transposition which systematically interchanges pairs of elements that are out of order until no more such pairs exist

Polymorphism

exhibiting different designs for the same behavior (ie method name) as a result of objects of different classes; not the same as overriding

CH11: This key word indicates that a class inherits from another class.

extends

Which of the following is a valid value for a boolean variable?

false

analysis

feasibility study; result is a requirements specification

zero-indexing

first element begins at zero as opposed to one

Which of the following data types can hold the number 3,000,000,000 (three billion)?

long and float

count-controlled loop

loop body is executed a fixed number of times

posttest loop

loop body is executed at least once, then condition is tested

sentinel-controlled loop

loop body is executed until a certain condition is met

directories/folders

Groups of files.

Nested

A statement placed within the same type of statement

import statement

A statement that allows you to use imported code such as double, color, and scanner.

Binary operator

An operator that takes two arguments, for example + in x+ y.

This type of loop will always be executed at least once.

Post-test loop

Scanner sc = new Scanner(System.in);

create a scanner object named sc

Ignoring Case in String

equalsIgnorCase, or compareToIgnoreCase

exception

error condition that can occur during the normal course of program execution; exception is thrown

short circuit evaluation

evaluation in which the programmer puts the conditions more likely to cause the control statement to not execute first

delegation based event model

event handling implemented by two types of objects: event source and event listener objects

try-catch control statement

exception control statement; statements are executed in the try block, when an exception is thrown, catch block is executed and rest of try block ignored

Decrement

number--; or --number;

What are floating-point numbers?

numbers with fractional parts

What is an accessor method?

returns data without changing the object.

unchecked exceptions

runtime exceptions; unchecked at compile time and detected only at runtime

construction phase

satisfy the structural constraint (numbers places in heap); satisfy the value relationship constraint (start w/ last parent node)

import packagename.ClassName;

what is the syntax of the import statement

Comparison Operators

>,<,>=,<=,==,!= ... greater than, less than, greater than or equal to, equal to and not equal to...used to compare like data items for making decisions on how to process, syntax may differ from language to language.

One unary Logical operator.

! serve the truth of a boolean expression.

Comment-Block

"""(Triple double quote) Symbols used to designate in-line comments ... used to explain a single line of processing when it is not evident by the code written.

Comment-In line

# (Pound or hash) symbol used to designate in-line comments...used to explain a single line of processing when it is not self evident by the code written.

printf %.2f format

%.2f floating point value will be printed, round to two decimal places.

Two binary Logical operators

&& and ||

What are the three boolean operators?

&&, II, !

assigment operator

(equal sign)

Dictionary Ordering

(i.e. lexicographic ordering) Ordering strings in the same order as in a dictionary, by skipping all matching characters and comparing the first nonmatching characters of both strings.

Decision Structure

(same as conditional control structure)

What is the syntax of cast?

(typeName) (expression) - parenthesis are optional on the expression if no arithmetic operator is used

arithmetic operatiors

+ addition - subtractions or negation * multiplication

increment operator

++, which increases the value of a variable

Comparing Characters

- Character can be tested with relation operators.

Where does Character stored in?

- Characters are store in memory of the Unicode.

Switch Statement

- The switch statement allows you to use an ordinal value to determine how a program will branch. -The switch statement can evaluate an integer type or character type variable and make decisions based on the value.

What is the opposite of <?

>=

decrement operator

--, which decreases the value of a variable

What values can a byte hold ?

-128 to 127

what values can a int hold?

-2,147,483,648 to 2,147,483,647

What values can a short hold?

-32,768 to 32,767

what values can a long hold?

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Object-oriented programming

-Identify and define objects and solve problems by manipulating objects -look at everything as objects that already have a set of directions

CH14: If an array is sorted in this order, the values are stored from highest to lowest.

...

CH14: If an array is sorted in this order, values are stored from lowest to highest.

...

CH14: In this sorting algorthm, the smallest value in the array is located and moved to position 0. Then the next smallest value is located and moved to position 1. This process continues until all of the elements have been placed in their proper order.

...

CH14: This search algorithm repeatedly divides the portion of an array being searched in half.

...

CH14: This search algorithm requires that the array's contents be sorted.

...

CH14: This search algorithm will search half the array on average.

...

CH14: This sorting algorithm begins by sorting the initial portion of the array consisting of two elements. At that point, the first three elements are in sorted order. This process continues with the fourth and subsequent elements until the entire array is sorted.

...

CH14: This sorting algorithm recursively divides an array into sublists.

...

What are the benefits of information hiding?

...

Byte code

.java code is compiled into this

The random method generates numbers greater than or egual to

0 and less than 1

How many times will the following do-while loop be executed? int x = 11; do { x += 20; } while (x > 100);

1

What are the four rules of selecting identifiers?

1. cannot start with digits; 2. Can be made of letters, digits, underscore, and dollar sign; 3. cannot use spaces or symbols other than $; 4. cannot use reserved words

Name conventions for creating identifiers.

1. variable and method names start with a lowercase letter; 2. Camel case is OK.; 3. Class names should start with an uppercase letter; 4. Should not use $ in names; it is intended for automatically generated names.

How many constructors does the Scanner class have in Java 7?

10

What will be the value of x after the following code is executed? int x = 10; while (x < 100)

100

How many times will the following for loop be executed? for (int count = 10; count <= 21; count++) System.out.println("Java is great!!!");

12

What will be the value of x after the following code is executed? int x, y = 15; x = y--;

15

What will be the value of x after the following code is executed? int x = 10; do { x *= 20; } while (x < 5);

200

What will be the value of x after the following code is executed? int x = 10, y = 20; while (y < 100) { x += y; y += 20; }

210

What will be printed after the following code is executed? for (int number = 5; number <= 15; number +=3) System.out.print(number + ", ");

5, 8, 11, 14

How many native methods does the Scanner class have in Java 7?

55

In Java each statement ends with a:

; (semicolon)

What is an expression?

A combination of literals, variables, operators, and/or methods.

What are common utility methods?

?

Applet

A Java program that can be downloaded and run on a Web browser

Managed bean

A JavaBean that is managed by a JSF container.

Prepared Statement

A SQL statement with a precomputed query strategy

What does the Scanner class do?

A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods.

Binary search tree

A binary tree in which each subtree has the property that all left descendants are smaller than the value stored in the root, and all right descendants are larger.

Nested block

A block that is contained inside another block.

Escape Character

A character in text that is not taken literally but has a special meaning when combined with the character or characters that follow it. The \ character is an escape character in Java strings

Assertion

A claim that a certain condition holds in a particular program location

Class - Property

A class coped variable for holding data relative to the object instantiated from the class.

Cohesion

A class is cohesive if its features support a single abstraction

Class -Method

A class member function or procedure that contains code for processing on the object instantiated from the class.

Collaborator

A class on which another class depends

Event Class

A class that contains information about an event, such as its source

Event Adapter

A class that implements an event listener interface by defining all methods to do nothing

Exception

A class that signals a condition that prevents the program from continuing normally. When such a condition occurs, an object of the exception class is thrown

Primary Key

A column whose value uniquely specifies a table record

Client

A computer program or system that issues requests to a server and processes the server responses

Postcondition

A condition that is true after a method has been called.

Precondition

A condition that must be true when a method is called if the method is to work correctly.

What happens when String s1 = "Hi"; then s1 += "1": ?

A copy of "Hi" is made and the variable s1 is pointed to the new object. The ! is added to the new object. s1 no longer refers to the original "Hi", though it still exists in memory until garbage collection frees the memory.

Map

A data structure that keeps associations between key and value objects.

Procedure

A defined module of code that performs a specific task

Binary search

A fast algorithm to find a value in a sorted array. It narrows the search down to half of the array in every step.

Binary file

A file in which values are stored in their binary representation and cannot be read as text.

double

A floating point number, or a decimal.

Block

A group of statements bracketed by {}

Array list

A java class that implements a dynamically growable array of objects

Border layout

A layout management scheme in which components are placed into the center or one of the four borders of their container

Doubly Linked List

A linked list in which each link has a reference to both its predecessor and successor links

variable.

A location in memory intended to store data temporarily.

What is a loop and a half?

A loop in which the terminate condition is located in the middle of the code.

Nested loop

A loop that is contained in another loop.

Loop and a half

A loop whose termination decision is neither at the beginning nor at the end.

Call by value

A method call mechanism in which the method receives a copy of the contents of a variable supplied as an actual parameter. Java uses only _________. If a parameter variable's type is a class, its value is an object reference, so the method can alter that object but cannot make the parameter variable refer to a different object.

Call by reference

A method call mechanism in which the method receives the location in memory of a variable supplied as an actual parameter. ____ enables a method to change the contents of the original variable so that the change remains in effect after the method returns.

Mutator method

A method that changes the state of an object.

Event Handler

A method that is executed when an event occurs

Predicate Method

A method that returns a Boolean value

Linear Congruential Method

A method that uses a formula to generate a sequence of pseudorandom numbers

Member

A method, field, or type defined inside a class.

Attribute

A named property that an object is responsible for maintaining

Function

A named, defined module of code that performs a specific task and returns a value.

javax.swing

A newer package called Swing that provides classes to create graphical user interfaces and applets

Byte

A number made up of 8 bits; the smallest unit of storage in memory

Magic number

A number that appears in a program without explanation.

java.awt.event

A package that provides classes necessary to handle events.

Explicit Parameter

A parameter of a method other than the object on which the method is invoked

'Catch' clause

A part of a 'try' block that is executed when a matching exception is thrown by any statement in the 'try' block

Permutation

A rearrangement of a set of values.

Association

A relationship between clases in which one can navigate from objects of one class to objects of the other class, usually by following object references

Loop

A sequence of instructions that is executed repeatedly

computer program

A sequence of instructions written to perform a specified task with a computer.

DTD (Document Type Definition)

A sequence of rules that describes the legal child elements and attributes for each element type in an SGML or XML document

Method

A sequence of statements that has a name, may have formal parameters, and may return a value. A method can be invoked any numbers of times, with different values for its parameters.

Exception Handler

A sequence of statements that is given control when an exception of a particular type has been thrown and caught

program

A set of instructions for the computer.

Network protocol

A set of rules that must be followed by programs that communicate over a network.

Algorithm

A set of steps that tell how to solve a problem.

Character

A single letter, digit, or symbol

IDE

A software that allows you to write, and compile codes in one place.

Merge sort

A sorting algorithm that first sorts two halves of a data structure and then merges the sorted subarrays together.

parameter

A special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input.

What is a number literal?

A specific value like "27" or 0.1677

Seed

A starting value for calculating a sequence of random numbers

Loop invariant

A statement about the program state that is preserved when the statements in the loop are executed once.

Directory

A structure on a disk that can hold files or other directories; also called a folder.

operating system

A supervisory program that oversees the entire operation of the computer.

operator

A symbol denoting a mathematical or logical operation, such as + or &&

Truth Table

A table that shows the possible outcomes of two expressions joined by a logical operator.

Buffer

A temporary storage location for holding values that have been produced and are waiting to be consumed or read

Boundary test case

A test case involving values that are at the outer boundary of the set of legal values. For example, if a function is expected to work for all nonnegative integers, then 0 is a boundary test case

Positive Test Case

A test case that a method is expected to handle correctly.

Negative test case

A test case that is expected to fail. For example, when testing a root-finding program, an attempt to compute the square root of -1 is a negative test case.

Blocked thread

A thread that cannot proceed because it is waiting for some external event

Binary tree

A tree in which each node has at most two child nodes.

Branch- If-Then-Else/Elself

A type of branching statement used in most languages...it's syntax may differ from language to language.

data

A type of input for a program; the information that the computer program will process.

Enumerated Type

A type with a finite number of values, each of which has its own symbolic name

Boolean type

A type with two possible values: true and false

Prefix Operator

A unary operator that is written after an argument.

Postfix operator

A unary operator that is written after its argument

Check box

A user interface component that can be used for a binary selection.

Combo box

A user interface component that combines a text field with a drop-down list of selections

terminal I/O interface

A user interface that uses text rather than buttons and images.

object

A value of a class type

Memory location

A value that specifies the location of data in computer memory.

Program

An organized list of instructions that, when, executed, cause the computer to behave in a predetermined manner.

software

All the different kinds of programs used to give instructions to the computer.

Logical Operators

And, or, not... in Python also is and in ... assist in setting up proper logic in a program, basic Boolean logic is performed when executing.

abstract window toolkit

ABT

Sequential access

Accessing an array by searching the whole array

Direct access

Accessing an array through an arbitrary location

Name clash

Accidentally using the same name to denote two program features in a way that cannot be resolved by the computer.

memory location

Adjacent bytes. The address of the first byte is used as the address for this.

Which of these is a convention for naming variables in java

After the first word in the variable name, each successive word begins with a capital letter.

Partially-filled array

An array that is filled to capacity, together with a companion variable that indicates the number of elements actually stored.

Branch- If

An else or elself condition is not necessary for every if condition, the programmer is responsible for knowing when these are required and when they are not.

Logic error

An error in a syntactically correct program that causes it to act differently from its specification.

Roundoff error

An error that occurs when a floating point number cannot be exactly represented in binary notation by the computer

Checked exception

An exception that the compiler checks. All of these must be declared or caught.

Boolean expression

An expression that evaluates to true or false

Compound Boolean Expression

An expression that includes more than one Boolean expression

object

An individual instance of a class. An object can only exist during runtime.

If a loop does not contain within itself a way to terminate, it is called

An infinite loop

What is a parameter?

An input to a method

object

An instance of a class.

Class - Object

An instantiated item of the class...can be thought of as a variable of the class type.

Event Source

An object that can notify other classes of events

Event Listener

An object that is notified by an event source when an event occurs

instance

An object.

java.awt

An older package called the Abstract Window Toolkit (AWT) that provides classes to create graphical user interfaces.

java.applet

An older package that provides classes to create an applet.

new operator

An operator that allocates new objects

Logical operator

An operator that can be applied to Boolean values. Java has three logical operators: &&, ||, and !.

What does it mean to initialize a variable?

Assign it a first value.

Auto-boxing

Automatically converting a primitive type value into a wrapper type object

Which of the following will open a file named MyFile.txt and allow you to append data to its existing contents? A) FileWriter fwriter = new FileWriter("MyFile.txt"); PrintWriter outFile = new PrintWriter(fwriter); B) FileWriter fwriter = new FileWriter("MyFile.txt", true); PrintWriter outFile = new PrintWriter(fwriter); C) PrintWriter outfile = new PrintWriter("MyFile.txt", true); D) PrintWriter outfile = new PrintWriter(true, "MyFile.txt");

B) FileWriter fwriter = new FileWriter("MyFile.txt", true); PrintWriter outFile = new PrintWriter(fwriter);

non-static variable.

Belongs to the object and will be recreated with each instantiation

Bit

Binary digit; the smallest unit of information, having two possible values: o and 1. A data element consisting of n bits ahas 2^n possible values

A group of statements organized between { } braces

Block Statement

Conditional Operator format

BooleanExpression? Value1 : Value2 ex: - if BooleanExpression is true, the value of conditional expression is Value1 - if BooleanExpression is false, the value of conditional expression is Value2.

Asymmetric bounds

Bounds that include the starting index but not the ending index

Print

Built in method for getting output to the user.

Way can be static?

Classes, methods, and variables.

What does the keyword final do to a variable?

Changes it to a constant. final means the value cannot never change once set.

Early Binding

Choosing at compile time among several methods with the same name but different parameter types

Used to define the attributes of an entire class of objects and apply to all instances of it .

Class Variables

What is the advantage of inheritance?

Code is reusable. It saves time; more efficient.

library files

Code that has been written and compiled by someone else to make it available to programmers for use in programs.

method

Code that performs some action defined by a class.

comments

Code that the Java compiler skips when transferring into a program.

Error checking

Code to check that input is the correct data type or to insure the proper data is being processed.

signature

Combination of identifiers, return value, name and parameters of a method. Example: public int calculateMonth(String name)

What are utility classes and methods?

Common, often-used functions.

equals(String)

Compares the value of the String object with a String argument and returns a true value if they are equal. Comparison is case-sensitive.

compiler

Compiles your code into a code that your computer can use.

A loop that executes as long as a particular condition exists is called a(n) _____.

Conditional loop

|| ( OR )

Connect two boolean expression into one. It is only one side needs to be true.

&& ( AND )

Connects two boolean expression into one. Both expression must be try for the overall expression to be true.

string

Contains characters to be printed.

Mutual recursion

Cooperating methods that call each other.

A loop that repeats a specific number of times is known as a(n) _____________.

Count-controlled loop

Assuming that inputFile references a Scanner object that was used to open a file, which of the following statements will read an int from the file? A) int number = inputFile.next(); B) int number = inputFile.integer(); C) int number = inputFile.readInt(); D) int number = inputFile.nextInt();

D) int number = inputFile.nextInt();

Meta data

Data that describe properties of a data set.

String

Data type that is text based, usually denoted inside a pair of double quotes for example "this is a string"

printf %d format

Decimal integer will be printed. ex: int hours = 40; System.out.printf( "I worked %d hours.), hours;

What is the difference between final variables declared in the class vs the method?

Declarations in the class should include an access specifier (usually public) and the word static. The ones in methods get the default access specifier and static is not used.

What are parameter variables?

Declared within the method header

class

Defines the characteristics and actions of an object. Models things from the problem domain.

This is an item that separates other items.

Delimiter

Object-oriented design

Designing a program by discovering object, their properties, and their relationships

processor/CPU/central processing unit/chip

Device inside a computer that follows a program's instructions

bit

Digit that can assume only two values: 0 and 1.

Case-sensitive

Distinguishing upper- and lowercase characters.

CH11: With this type of "binding", the Java Virtual Machine determines at runtime which method to call, depending on the type of the object that a variable refences.

Dynamic

How do you test for equality between objects?

Each class must supply an equality method. There is no generic equality method.

byte

Eight bits of memory.

==

Equal

byte code

Executed by the java virtual machine, code that gets created when we compile the .java file.

Cast

Explicitly converting a value from one type to a different type. E.g. converting from a floating-number 'x' to an integer is expressed by '(int) x'.

A statement that produces a value

Expression

True or False The do-while loop is a pre-test loop.

False

True or False In a for loop, the control variable can only be incremented.

False

True or False The do-while loop is a pre-test loop.

False

True or False\ When the break statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.

False

T/F Java allows multilevel inheritance.

False.

GUI

Graphical User Interface, a user interface based on graphics ,icons, pictures, and menus instead of text.

>

Greater than

CH12: This is one or more statements that are always executed after the try block has executed and after any catch blocks have executed if an exception was thrown.

Finally block

running/executing

Following the instructions in the program.

Syntax error

Forgetting a semicolon or brace

event source

GUI object where the event occurs

Navigation rule

In JSF, a rule that describes when to move from one web page to another.

Method binding

In JSF, an expression describing a bean and a method that is to be applied to the bean at a later time.

Primitive type

In Java, a number type

Mixed content

In XML, a markup element that contains both text and other elements.

Bucket

In a hash table, a set of values with the same hash code

What is the modulo used for?

It is used in integer division to return the remainder only.

keyword final

It is used in several contexts to define an entity that cannot be changed.

What does overloaded mean?

It means a method name is used more than once, but with different parameters.

Markup

Information about data that is added as humanly readable insurrections. An example is the tagging of HTML documents with elements such as <h1> or <b>.

What object oriented concept is exemplified by Java class heirarchies?

Inheritance

Buffered input

Input that is gathered in batches (e.g. a line at a time)

Used to define an objects attributes

Instance Variables

deprecated

It means the programmer is better off not using that method because it may cause problems or because a better one exists.

Why must main be static?

It must be able to work without an object because an object has not yet been created when main runs.

What is an instance method?

It operates on an object.

final method

It refers to a method that cannot be overriden by subclasses usually because the method is essential to the proper function of the class.

What does multilevel inheritance mean?

It refers to an extension of an extension.

In what class does the equals method reside?

It resides in the java.lang.object class.

Bytecode

Instructions for the Java Virtual Machine (JVM)

Machine code

Instructions that can be executed directly by the CPU.

What is a prompt?

Instructions to the user on what to enter

Java

Interpreted, platform independent, object oriented language

A sentinel value ____________ and signals that there are no more values to be entered.

Is a special value that cannot be mistaken as a member of the list

What does a static variable mean?

It belongs to the class, not the object. Will affect how it is handled in memory.

what does the method compareTo do?

It compares strings in dictionary order

What is an empty string and how is it represented?

It contains no characters and is typed: ""

What is a static method?

It does not operate on an object.

What does the cast method return?

It drops the remainder and returns only the whole number.

What does printf do?

It formats numbers and then prints them to the screen.

What does String.format do?

It formats strings and then assigns them to a variable

What does string [] array = "Hello".split(""); do?

It inserts nothing in index 0, and one character in index 1-5. It does this because there is no delimiter.

final class

It is a class that cannot be subclassed. (Ex: public final x extends y is illegal if y is a final class.)

What is a magic number?

It is a number literal that appears in code without explanation.

What is the purpose of "this"?

It is a synonym for the implicit parameter; useful if the name of the instance variable is repeated as a parameter or local variable.

What is an explicit parameter?

It is a variable for passing data into a method.

What is a package in Java

It is collection of classes with a related purpose.

What is a local variable?

It is declared within the body of a method

java.lang

It is the highest level of the Java library and provides classes fundamental to the language.

What is an implicit parameter?

It is the object on which the method is called.

What is a simulation program?

It uses the computer to simulate a real world condition and make predictions.

When you divide two int data type variables what happens ?

It will drop the remainder and round down .

What is the type of an object?

Its class. (ex. type for System.out is Printstream.)

CH13: To display a dialog box that allows the user to select a color, you use this class.

JColorChooser

CH13: To display an open file or save file dialog box, you use this class.

JFileChooser

CH13: You use this class to create a menu bar.

JMenuItem

CH13: You use this class to create a radio button menu item.

JRadioButtonMenuItem

CH13: Components of this class are multi-line text fields.

JTextArea

JVM

Java Virtual Machine, used to run Java byte code.

statements

Java _____ directs the operations of a program.

JDK

Java development kit

JRE

Java runtime environment

Primitive types

Java variable -- Simple values stored directly in the memory location associated with the variable

files

Larger units of auxiliary memory.

Function - Return

Last statement in a function for returning a value to the calling code, syntax may differ from language to language.

Abstraction

Meaning we do not need to know the implementation details in order to use them

Statement

Line of code ending in semicolon.

Used inside method definitions or even smaller blocks of statements within a method ..you can use them only while the method or block is being executed by the java interpreter.they cease to exist afterward

Local Variables

Running Totals

Loops allow the program to keep running totals while evaluating data.

machine languages/assembly languages

Low-level languages produced by compilers.

public static void main(String[] arguments) { }

Main method

Cloning

Making a copy of an object whose state can be modified independently of the original object

Name four classes that belong to java.lang.

Math, String, System, Integer

What is the difference between Math.random and Random?

Math.random calls the nextDouble method from Random. Random has generators for many types of random numbers.

What is the difference between next() and nextline()?

Next will return the next word whereas nextline will return everything before the return character.

Is it legal to store a value in a variable that is not that variable's type?

No, it is an error.

does a variable contain an object?

No, it only refers to the object.

Is "" the same as null

No, one is a string of length 0, the other refers to nothing

Is a constructor a method?

No, the constructor can only be called using the new statement.

Are numbers objects?

No, they are not objects and therefore have no methods.

Comment

Non-executable text that describes the processing of an area of code, documentation in English of what the program is doing.

What class is at the root of the class heirarchy?

Objecct

CH11: All classes directly or indirectly inherit from this class.

Object

Method

Object oriented term for a named,defined module of code, e.g. a function or procedure.

statement

One instruction in a computer program.

Relational Operator

Operators ( = = , < , <=, > = , ! =) that can be used to form a Boolean expression

Character are

Ordinal. ex: char c = 'A'; if ( c < 'z') System.out.println("A is < Z");

private method can only be accessed by ?

Other methods of the same class.

CH11: A method in a subclass having the same name as a method ina superclass but a different signature is an example of _______.

Overloading

CH11: A method in a subclass that has the same signature as a method in the superclass is an example of _______.

Overriding

Assignment

Placing a new value into a variable

opening a file

Preparing a file for reading or writing

open a file class

PrintWriter outputFile = new PrintWriter("Example.txt");

Printwriter Class

PrintWriter outputFile = new PrintWriter("Names.txt"); outputFile.println("Chris"); outputFile.println("Kathryn"); outputFile.println("Jean"); outputFile.close();

Compile

Program code is broken down into machine code (compiled) and an executable form of the program is then run.

Interactive

Program code is interpreted and executed as it is typed.

low-level languages

Programming languages that a computer can (more directly) understand.

high-level languages

Programming languages that are designed for people to use.

Branch

Programming statements that allow decisions to be made so that different branches of program code may be executed

CH11: These superclass members are accessible to subclasses and classes in the package.

Protected

java.lang

Provides classes fundamental to Java, including classes that work with primitive data types, strings, and math functions.

java.text

Provides classes to handle text, dates, and numbers

java.sql

Provides classes to read data from databases and to write data to databases.

java.io

Provides classes to read data from files and to write data to files.

java.util

Provides various utility classes including those for working with collections.

This is a sum of numbers that accumulates with each iteration of a loop.

Running total

Difference between runtime and logic errors

Runtime errors prevent code form compiling; logic errors generate performance other than what is intended.

The value produced by a statement

Return Value

auxiliary memory

The various kinds of disks that are used with computers.

What class does hasNextDouble() belong to ?

Scanner

Boolean operator

See Logical operator

Polymorphism

Selecting a method among several methods that have the same name on the basis of the actual types of the implicit parameters.

This is a value that signals when the end of a list of values has been reached.

Sentinel

What is the purpose of a constructor?

Set the initial data for an object.

The control variable (for loop)

Should avoid updating the control variable of a for loop within the body.

Project

Simple or complex tasks that require multiple steps.

method

Specifies the actions of an object.

type

Specifies what kind of thing a variable or a parameter is. Example: int, char, boolean...

Program - Naming

Start with lover case letter and remain all lower case, usually an abbreviated name that denotes the processing being performed.

Function - Naming

Start with lower case letter and remain all lower case, usually a name that denotes the processing being performed.

Procedure - Naming

Start with lower case letter and remain all lower case, usually a name that denotes the processing being performed.

Variable - Naming

Start with lower case letter, then camel-hump notation, usually a name that denotes the data being stored.

Variable

Storage location in memory for data who's value may change during the running of the program.

Constant

Storage location in memory for data who's value will not change during the running of the program.

how do I terminate a main method that involves as window pane?

System.exit(0);

T/F Strings are objects of the class String.

TRUE

Black-box testing

Testing a method without knowing its implementation

Logical Not

The ! operator used to reverse the value of a Boolean expression

Logic error

The "dangling else problem"

Logical And

The && operator used to form a compound Boolean expression

Newline

The '\n' character which indicates the end of a line

The random method produces pseudorandom numbers, what are those?

The CPU does not produce truly random numbers. It produces strings of digits without a repeating pattern for high quantity of output.

What is the rule for pairing Else statements with If statements?

The Else is paired to the closest If, unless braces are used to group otherwise.

You can use this method to determine whether a file exists.

The File class's exists method

System.out?

The System class is calling a field from the Printstream class.

In the following code, what values could be read into number to terminate the while loop? Scanner keyboard = new Scanner(System.in); System.out.print("Enter a number: "); int number = keyboard.nextInt(); while (number < 100 && number > 500) { System.out.print("Enter another number: "); number = keyboard.nextInt(); }

The boolean condition can never be true

The Case Statement

The break ( switch statement) statement ends the case statement

multiple instances

The case when there are multiple objects from the same class instantiated at runtime.

What is a superclass?

The class from which a subclass is extended.

What does the x stand for in javax.swing.JFrame?

The class started out as an extension and was later adopted as part of the standard library.

What are primitive types?

The classification for ints, doubles, longs, chars, boolean, etc.

Branch - if/elself

The condition in these statements must evaluate to true in order for the code to be executed, otherwise the else or next elself statement will be evaluated.

End of File

The condition that is true when all characters of a file have been read, Note that there is no special "end of file character". When composing a file on the keyboard, you may need to type a special character to tell the operating system to end the file, but that character is not part of the file

Encapsulation

The hiding of implementation details

The if Statement

The if satement decides whether a section of code executes or not.

source program/source code

The input program.

Program - Main

The main portion of the program/the starting point of the program, in some languages this is an actual method.

What is an object reference?

The memory location of an object.

main method

The method that is first called when a Java application executes.

Method signature

The name of a method and the types of its parameters.

Big-Oh notation

The notation g(n) = O(f(n)), which denotes that the function g grows at a rate that is bounded by the growth rate of the function f with respect to n. For example, 10n^2 + 100N - 1000 = O(n^2)

Dot Notation

The notation object.method(parameters) or object.field used to invoke a method or access a field

address

The number of a byte.

Call stack

The ordered set of all methods that currently have been called but not yet terminated, starting with the current method and ending with 'main'.

Keywords

These have a special meaning in the program and cannot be used in other ways (eg class, if, while)

method selector operator

The period that separates the method and the object.

hardware

The physical machine.

Object-oriented

The primary mode of execution of objects with each other

Class -Instantiate

The process of creating a new object of a particular class type...usually involves the key word "new"

Debug

The process of solving/eliminating errors in/from program code.

source code

The programming language code for a computer.

Class path

The set of directories and archives that the virtual machine searches for class files

Operating system

The software that launches application programs and provides services (such as a file system) for those programs

assignment operator

The symbol =, which is used to store a value in a variable.

Class

The template containing methods and properties for a specific object the building blocks of Object Oriented languages

object program/object code

The translated low-level-language program that the compiler produces.

Dependency

The uses relationship between classes, in which one class needs services provided by another class

return value

The value that comes back from a method after it is run. In the following method: public int calculateMonth(String name), the return value is an integer.

state

The values of all of the variables in an object at a given time.

What are the two rules for costructors?

They must have the same name as the class and they have not return type, not even void

CH12: All exception classes inherit from this class.

Throwable

What is the meaning of inheritance?

To take something that is already made

compile

To translate from a high-level program to a low-level one.

True or False When you pass the name of a fi le to the PrintWriter constructor, and the file already exists, it will be erased and a new empty file with the same name will be created.

True

True or False The do-while loop must be terminated with a semicolon.

True

What are the three components of a variable?

Type, name, and contents (value).

What is Unicode?

Unicode is stored as a sixteen(16) bit number.

If you can't find the character on the keyboard what option does a programmer have to print the character?

Use the unicode equalivalent

What is an application programmer?

Uses Java to create new applications.

static variable

Variable belongs to the class not e object. Value will not change across instances. For each application, the variable will only be created once in memory even though multiple instantiations of the class exist.

Variable - Dynamically Typed

Variable is bound only to an object at compile time.

Variable - Statically Typed

Variable is bound to a data type at compile time and an object.

What is a side effect?

When an assignment is used in a test.

When should I use integers?

When the value can never have a fractional part

When should I use doubles

When the value may have a fractional part.

Infinite Loops

While loop.

While Loop

While the condition is true, the statements will executed repeatedly. While (condition) { Statements; }

What are integers?

Whole numbers

main memory/RAM

Working memory that a program uses for intermediate calculations.

equalsIgnoreCase(String)

Works like the equals method but is not case-sensitive.

Can a class be static?

Yes, but only an inner class.

is anything wrong with 150,000?

Yes, in Java commas are not allowed as decimal separators

Is a static method declared inside classes?

Yes, just like instance methods.

Is anything wrong with 5 1/3?

Yes, the forward slash is not a valid method for representing fractions.

Are most utility methods static?

Yes.

Can a break statement be used in loops?

Yes.

Is java.lang a package?

Yes.

programming language

a set of rules symbols and special words used to construct programs

Why is it good practice to give local variables initial values

You must give values to local variables before you use them in a program or the program won't compile successfully.

Why do you want to generally avoid using == when comparing strings?

You want to compare the contents of two objects, not the references. Remember strings are objects.

quotation mark

\"

backslash

\\

new line

\n

return

\r

tab

\t

The condition of an If statements is

a Boolean expression

CH13: The setPreferredSize method accepts this as its argument(s).

a Dimension object

printf %s format

a String will be printed.

keyword

a _____ is a word that is reserved by the java language

method

a block of code that performs a task

String

a built-in Java class that provides you with the means for storing and manipulating character strings.

floating point

a data type th deals wit decimal numbers

boolean

a data type that deals with logical values and has the values

intergral

a data type the deals with interger

Scientific notation

a display format that more conveniently expresses large or small numeric values; a multidigit number is converted to a single-digit number and multiplied by 10 to a power.

logical expression

a expression that evaluates to true or false

Blank final

a final variable that has not yet been assigned a value.

Do loop

a loop that has 0 or more iterations of the loop body

while loop

a loop that has 1 or more iterations of the loop body

repetition statement

a loop; control a block of code to be executed for a fixed number of times or until a certain condition is met

named constant

a memory location whose content is not allowed to change during program excution

Named constant

a memory location whose declaration is preceded by the keyword final and whose value cannot change during program execution.

Prompt

a message that requests and describes user input.

Unary cast operator

a more complete name for the cast operator that performs explicit conversions.

Symbolic constant

a named constant.

Variable

a named memory location that you can use to store a value.

Numeric constant

a number whose value is taken literally at each use.

What loop is 'While Loop'?

a pretest loop. It will test the value of the condition prior to executing the loop.

oracle

a program that predicts how another program should behave overloading,giving more than one meaning to a method name overriding,redefining a method in a subclass package,a collection of related classes. The import statement is used to access one or more of the classes in a package

null reference

a reference that does not refer to any object

statement terminator

a semicolon is used to terminate a statment

string

a series of characters in quotes

object reference

a value that denotes the location of an object in memory, In Java a variable whose type is a class contains a reference to an object of that class off by one error,a common programming error in which a value is one larger or smaller than it should be

Magic number

a value that does not have immediate, intuitive meaning or a number that cannot be explained without additional knowledge such as an nnamed constant.

Magic number

a value that does not have immediate, intuitive meaning or a number that cannot be explained without additional knowledge. Unnamed constants are magic numbers.

Literal constant

a value that is taken literally at each use.

object

a value that the programmer can manipulate by calling its methods

Operand

a value used in an arithmetic statement.

variable

a variable contains a number or value that can be changed throughout the life of a program.

Constant variable

a variable with a value that never changes.

Statements and expression

a way to manipulate/operate on the data

Integer

a whole number without decimal places.

What are the four parts of a method header?

access specifier, return type, name, parameter variables

What are the three parts of an instance variable?

access specifier, type, and name

What are public and privare examples of?

access specifiers

package access

accessibility by methods of classes in the same package panel,a user interface component with no visual appearance. It can be used to group other components parallel arrays,arrays of the same length in which corresponding elements are logically related

CH13: A JComboBox component generates this type of even when the user selects an item.

action event

test-section (for loop)

acts in the same manner as the condition section of while loop.

CH13: To display a scroll bar with a JList component, you must _________.

add the JList component to a JScrollPane component

if - else Statements

adds the ability to conditionally execute the code when the if condition is false.

Whats the traditional naming for constants

all CAPITALS

integral expression

all numerical operands in an expression yields a floating point numbers

initialization section (for loop)

allows the loop to intialize its own control varialbe.

binary search

array must already be sorted; O(log2n) comparisons; search starts in the middle of the array and searches the array by halves

Initialization

an assignment made when you declare a variable.

Null String

an empty String created by typing a set of quotes with nothing between them.

Lvalue

an expression that can appear on the left side of an assignment statement.

Rvalue

an expression that can appear only on the right side of an assignment statement.

Nested if Statements

an if statement appears inside another if statement.

Promotion

an implicit conversion.

What does dividing an integer by an integer yield?

an integer. the remainder is discarded.

parameter

an item of information that is specified to a method when the method is called. for example, in the call System.out.println("Hello World"); the parameters are the implicit parameter System.out and the explicit parameter "Hello World".

instance

an object; created from a class

software life cycle

analysis, design, coding, testing, operation

&&

and operator, control statement executed when all the statements are true

Comparison operator

another name for a relational operator.

identifier

any name that you create in a java program

What is a literal

any number, text, or other information that directly represents a value.

CH11: In a subclass constructor, a call to the superclass constructor must__________

appear on the very first statement

main class

application class; contains the main method, start of the program

Relational Operators

are boolean expression. <, >,=, <=, >=, ==, !=

multiple line comments

are enclosed between /* and /*

identifiers

are names of things, such as variables, constant, methods and classes

associativity

arithmetuc operators is said to be from left to right

two-dimensional array

array with an array at each element in the array

What must be true for division to work?

at least one number must be a floating point number.

What are two other phrases for superclass?

base class or parent class

CH11: Abstract classes cannot _______.

be instantiated

single line comments

begin wthi // and can be replaced anywhere in the line

Escape sequence

begins with a backslash followed by a character; the pair represents a single character.

two types of files

binary and text

CH11: Fields in an interface are ________.

both final and static

CH14: This sorting algorithm makes several passes through an array and causes the larger values to gradually move toward the end of the array with each pass.

bubble sort

How does a program perform useful work?

by calling methods.

What are the 4 data types used for storing integers?

byte, short , int , long ,

CH12: This is an internal list of all the methods that are currently executing.

call stack

Break statment

can be use to terminate a loop.

Boolean variable

can hold only one of two values: true or false.

What is a mutator method?

changes the internal state of the object

CH12: All exceptions that do NOT inherit from the Error class or the RuntimeException class are ________.

checked exceptions

postcondition assertion

checks a condition that must be true after method execution

assertion

checks for a condition that must be true

precondition assertion

checks for a condition that must be true before a method is executed

What is another phrase for the subclass?

child class

Type-wrapper classes

classes contained in the java.lang package; include methods that can process primitive-type values.

How do you know that Math is a class and not an object in Math.round()?

classes start with uppercase letters. Objects start with lowercase letters.

array

collection of data values of the same type; reference data type

Concatenated

combine a value with another value.

Relational operator

compares two items; an expression that contains a relational operator has a Boolean value.

Reference types

complex data types that are constructed from primitive types.

What does lazy evaluation mean?

compound conditions are evaluated from left to right. If first evaluation resolves evaluation, second condition is not checked.

What is the syntax of the conditional operator?

condition ? value1 : value2 (ex. y = x||5 ? x : -x)

arithmetic expression

constructed by using arithmetic operators

Floating-point number

contains decimal positions.

variables

contents can be modified during program excution

control flow invariant

control must flow must flow invariably to a case

nested conditional

control statement within another control statement

What is a systems programmer?

creates the Java language itself.

Constant

data item that cannot be changed during the execution of an application.

orphaned data

data that isn't referenced anywhere

double

data type that can hold a floating-point value of up to 14 or 15 significant digits of accuracy.

float

data type that can hold a floating-point value of up to six or seven significant digits of accuracy.

short

data type that holds small integers, from -32,768 to 32,767.

long

data type that holds very large integers, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

byte

data type that holds very small integers, from -128 to 127.

char

data type used to hold any single character.

variable

data value that can change

properties

data values(members) -variables -constants

CH12: If your code does not handle an exception when it is thrown, it is dealth with by this.

default exception handler

overload a method

defining methods with the exact same name put with different sets of arguments/parameters -method will have a different body

operation

deployment and maintenance

Data type

describes the type of data that can be stored there, how much memory the item occupies, and what types of operations can be performed on the data.

Confirm dialog box

displays the options Yes, No, and Cancel.

Post-Test loops

do-while Loop

The indentation used in an if-else statement

does not affect the execution of the statement

8

double has how many bytes?

Encapsulation

effective information hiding -programmers do not have to concern themselves with details of program components

A Boolean expression evaluates to

either true or false

Which data type can usually be used to hold numbers with a decimal ?

float

What are the two data types for storing floating point numbers?

float and double

single prescision

float values

printf %f format

floating point value will be printed.

event-driven programming

flow of execution is determined by events;

This type of loop is ideal in situations where the exact number of iterations is known.

for loop

pre-test loop

for loop

Type casting

forces a value of one data type to be used as a value of another type.

What kind of layout does Java use?

free form layout - white space is ignored

double subtotal = sc.nextDouble();

get a double entry from the console using the scanner object named sc

CH12: This method can be used to retrieve the error message from an exception object.

getMessage

CH13: This JList method returns -1 if no item in the list is selected.

getSelectedIndex

binary tree

graph with edges, connected nodes such that there is a root node and no node has more than two children nodes

GUI

graphical user interface

>=

greater than or equal to

Lexical elements

groups of characters used in program code

type conversion

has the following form: (datatypename) expression

to open class

hover mouse over class name and press control

Abstraction

identification of properties and behavior of objects relevant to solving the problem at hand

decimal expression

if all operands are in an expression are floating point number

selection statement

if-else statements; chooses which step to do based on the parameters in the statements

coding

implement the design into a program; result is a program

switch statement

implements selection control flow

import java.util.Scanner

import a scanner class

PrintWriter Import

import java.io.*;

The Decimal Format

import java.text.DecimalFormat; System.out.println(ObjectName.format(ValueofPrintOut);

Where does an object store its variable?

in instance variables.

showConfirmDialog() method

in the JOptionPane class; used to create a confirm dialog box.

quick sort

in-place, divide-and-conquer, massively recursive sort; array is split in two parts based on a pivot point (one with elements larger than the pivot, one with elements smaller than the pivot) and is recursively repeated

How to consume input without doing anything with it?

in.nextLine();

Postfix

indicates that the variable will incremented or decremented after the rest of the equation has been evaluated.

array element

individual value in an array

What does encapsulation refer to?

information hiding within classes and supplying an interface

Prefix

inidcates that the variable will be incremented or decremented pior to the rest of the equation being evaulated.

object

instance of exactly one class, and belongs to that class

CH11: This operator can be used to determine whether a reference variable references an object of a particular class.

instanceof

instance data value

instances of the same class will possess the same set of data values

Name the eight primitive types and their sizes in Bytes.

int (4); byte(1); short(2), long(8), double(8);float(4); char(2); boolean(1/8 Bytes or 1 bit)

4

int has how many bytes?

Primitive types

int, float, and boolean variables are examples of this

What types can be used with a switch statement?

integer, enum, string, and characters

Flags

is a boolean variable that monitors some condition in a program. ex: if (average > 95) highScore = true; System.out.println("That's high");

computer program

is a sequence of statments inteneded to acomlish a task.

The conditional Operator

is a ternary (three operand) operator.

heap.

is an area of memory where objects are created.

An if-else statement that contains another if-else statement

is said to be nested

update- section (for loop)

is the last thing to execute at the end of each loop.

Input Validation

is the process of ensuring that user input is valid.

The update Expression (for loop)

is used to increment or decrement the counter variable declared int eh initialization section.

what is the purpose of in.hasNextDouble()?

it checks whether or not the next word in the input stream is a double

What does synchronized mean?

it means only one process can work with a piece of data at a time.

What does the modulus operator do ?

it produces the remainder (example 9%31 would return 4 )

What does object1 == object2 test?

it tests whether the variables both point to the same object.

What package can the compiler access without needing an import statement?

java.lang

what package are System, String, Math, Integer, etc. part of?

java.lang

CH13: The ListSelectionListener interface is in this package.

javax.swing.event

public

keyword that means that other classes can access the main method

final

keyword that precedes named constants.

Strongly typed language

language in which all variables must be declared before they can be used.

reconstruction step

last child is moved to root node, check and update the heap to satisfy the value-relationship constraint starting at the root

<=

less than or equal to

CH13: A JList component generates this type of event when the user selects an item.

list selection event

control statement

manipulate the sequence/order of execution of program statements; selection and repetition

ASCII

maps characters to a number; human and machine readable

exception handling

mechanism used to improve a program's robustness

class method

method defined for a class

instance method

method defined for an object

exception thrower

method that may directly or indirectly throw an exception

currentTimeMillis

method to see how much time something takes to execute

constructor

method with no return type; same name as class; default data members and values for instances of the class

Instance method

methods that are part of objects and can only b e called through an object

behaviors

methods; action for the object to do

CH13: This is a key that activates a component just as if the user clicked it with the mouse.

mnemonic

CH13: This is the JList component's default selection mode.

multiple interval selection mode

are strings changeable?

no

is the concat method of String class fast?

no, avoid it if speed is important.

Standard input device

normally is the keyboard.

Increment

number++; or ++number;

CH12: This method may be called from any exception object, and it shows the chain of methods that were called when the exception was thrown.

printStackTrace

to format number what two methods can I use?

printf or String.format.

CH11: A subclass does not have access to these superclass members.

private

programming

process of planning and created a program

event handler

processes the events and determines what to do

Javac

program used to compile .java files into .class files.

Java

program used to run .class files

CH11: When a class implements an interface, it must ________.

provide all of the methods that are listed in the interface, with the exact signatures and return types specified.

What are the four access specifiers?

public, private, protected, and default

What does string concatenation mean?

put one string and end of other to form one longer string.

For what purpose will I mainly use the Scanner class?

reading in keyboard input

string

reference data type; array of characters; immutable; pass-by-value

interface

reference data type; includes only constants and abstract methods

Significant digits

refers to the mathematical accuracy of a value.

Associativity

refers to the order in which operands are used with operators.

extraction phase

remove the root node to the output list then reconstruction step is executed

Echoing the input

repeat the user's entry as output so that the user can visually confirm the entry's accuracy.

Binary operators

require two operands.

design

requirements specification turned into a detailed design of the program; result is a set of classes that fulfill the requirements

Consume

retrieve and discard an entry without using it.

method

sequence of instructions that a class or an object follows to perform a task

CH14: This search algorithm steps sequentially through an array, comparing each item with the search value.

sequential search

linear search

sequential search; n/2 comparisons; array is searched from the first position to the last position

CH13: You can use this method to make a text field read-only.

setEditable

CH13: This method is inherited from JComponent and changes the appearance of a component's text.

setFont

CH13: This method can be used to store an image in a JLabel or a JButton component.

setIcon

CH13: You use this method to place a menu bar on a JFrame.

setJMenuBar

CH13: This method sets the intervals at which major tick marks are displayed on a JSlider component.

setMajorTickSpacing

What does string1 == string2 test?

since strings are objects, it tests whether or not s1 and s2 refer to the same object.

selection sort

smallest (or largest) value is found and transferred to the output area

token

smallest individual unit of a program written in any programming language

insertion sort

sort in which we assumed preceding records have been sorted, and the number is simply inserted into its proper place

parameter passing

specifying expressions to be actual parameter values for a method when it is called parse tree,a tree structure that shows how a string conforms to rules of a grammar

merge sort

splits the list into two equal halves and places them in separate arrays, each array is recursively sorted then merged back together to form the final sorted list

Reference types

store addressed of objects stored elsewhere in memory

Double-precision floating-point number

stored in a double.

Single-precision floating-point number

stored in a float.

what is boolean used for

storing true or false values

How to compare strings and ignore case?

stringEqualsIgnoreCase method

CH11: In an inheritance relationship, this is the specialized class.

subclass

predefined

such as NEXT INT, PRINT, and PRINTLN

CH11: This key word refers to an object's superclass.

super

CH11: The following is an explicit call to the superclass's default constructor.

super();

CH11: In an inheritance relationship, this is the general class.

superclass

Switch Statement ex:

switch (SwitchExpression) { case CaseExpression: // place one or more statements here break; case CaseExpression: // place one or more statements here default: }

The for loop

takes the form: for (initialization; test; update) { statement(s); }

syntax rules

tell you which statments are legal or accepted by the programming language

class

template for instantiating objects; dictates what an object can or cannot do; defines the properties and behaviors for an object

break statement

terminates switch statement; causes execution to continue from the statement following the switch statement

boolean expression

test condition

what should I do to compare floating point numbers?

test if they are close enough by defining a variable as E-14 and then x-y < E-14.

pretest loop

test is done before the execution of the loop body

Assignment

the act of providing a value for a variable.

Implicit conversion

the automatic transformation of one data type to another.

class

the basic unit of a java program

What happens if you break an identifier naming rule?

the compiler will return an error

How is the conditional operator different from the if/else statement?

the conditional operator returns a value and can therefore be assigned to a variable; the if/else statement is a statement and therefore cannot be assigned to a variable. It returns a statement.

operands

the constants and the variable in the expression

int

the data type used to store integers.

Explicit conversion

the data-type transformation caused using a cast operator.

Assignment operator

the equal sign (=); any value to the right of the equal sign is assigned to the variable on the left of the equal sign.

semantics

the et of rules that gives meaning to a language

initialized

the first time a value in the variables is placed in the variables

%6d

the integer will appear in a field that is 6 spaces wide.

Type-ahead buffer

the keyboard buffer.

keywords

the letter in a reserved word are always lowercase

Logical Or

the ll operator used to form a compound Boolean expression

precision

the maximum number of significant digits

identifier

the name of a variable, method, or class

printf %6.2f format

the number will appear in a field that is 6 spaces wide, and rounded to 2 decimal places.

Integer division

the operation in which one integer value is divided by another; the result contains no fractional part.

Remainder operator

the percent sign; when it is used with two integers, the result is an integer with the value of the remainder after division takes place.

Modulus operator

the remainder operator; also called mod.

operator associativity

the rule that governs in which order operators of the same precedence are executed. For example, in Java the - operator is left associative because a-b-c is interpreted as (a-b)-c and = is right associative because a=b=c is interpreted as a=(b=c)

operator precedence

the rule that governs which operator is evaluated first. For example in Java, the && operator has a higher precedence than the || operator. Hence a||b&&c is interpreted as a||(b&&c)

type variableName = value;

what is the syntax for declaring a variable?

String variableName = value;

what is the syntax for declaring and initializing a string variable

Operator precedence

the rules for the order in which parts of a mathematical expression are evaluated.

Interpreter

the software the executes byte code

Garbage value

the unknown value stored in an uninitialized variable.

CH12: You use this statement to throw an exception manually.

throw

CH12: When an exception is generated, it is said to have been ________.

thrown

CH12: This informs the compiler of the exceptions that could get thrown from a method.

throws clause`

cast operator

to avoid implicit type coercion java uses this

Parse

to break into component parts.

The printf Method

to perform formatted console output. System.out.printf (FormatString, ArgList);

floating point notation

to represent decimal numbers

what does it mean to declare a variable?

to reserve the space in memory (ex: int x;)

What is the char type used for

to store individual characters such as letters , numbers, punctuation and other symbols.

CH13: This is text that appears in a small box when the user holds the mouse cursor over a component.

tool tip

Boolean expression

true/false literals

CH12: You can think of this code as being "protected" because the application will not halt if it throws an exception.

try block

what are the two (three) parts of a variable declaration?

type and name (type, name, value)

bubble sort

type of exchange sort; compare the first pair of elements(exchange if needed), compare the second pair, third, fourth, and so on until the end of the list; highest number guaranteed to be in the last place after first sort

CH12: These are exceptions that inherit from the Error class or the RuntimeException class.

unchected exceptions

collating sequence

unicode character set

testing

unit testing or integration testing; debugging

Does Java 7 consider digits uppercase or lowercase?

uppercase

sort-in-place

use same same amount of memory space when sorted

What should I do if I want to round?

use the Math.round() method which returns a long.

How to convert double to int or vice versa?

use the cast operator

How to test equality of strings?

use the equals method: string1.equals(string2)

Relational or logical operators

used to compare primitive values

showInputDialog() method

used to create an input dialog box.

Arithmetic operators

used to perform calculations with values in your applications.

class data value

used to represent information shared by all instances or to represent collective information about instances

Unary operator

uses only one operand.

argument

value passed into an object

CH13: A list selection listener must have this method.

valueChanged

double precision

values of type double

interger literals

values such as 23 and-67

floating point literals

values such as a and 5

literals

values that are hard-coded into the program (integers and strings)

local variable

variable defined within a method that cannot be accessed outside of that method

protected

variables/methods available to any class that extends the original

comments

what are used to help document what the program does?

access modifiers

what controls what parts of the program can use the class?

block of code

what is the code within the braces called?

public|private class ClassName

what is the syntax for declaring a class?

public static void main (String[] args) { statements }

what is the syntax for declaring a main method?


Conjuntos de estudio relacionados

Managerial Accounting Final Exam

View Set

Color Theory Definitions and Examples

View Set

MGMT 3860 TRAINING AND ONBOARDING

View Set