Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
57 Cards in this Set
- Front
- Back
to use the Scanner class what must you put
|
import java.util.Scanner;
at the top of your source code file |
|
To create an instance of the Scanner class to read from the keyboard
|
Scanner myScanner = new Scanner(System.in);
|
|
For scanner- To read an int value and assign it to a variable
|
int myVariable = myScanner.nextInt();
(call nextInt() ) |
|
Sorting a list, finding the optimal route between cities, cracking a code, etc
|
algorithm
|
|
a set of instructions for solving a particular problem.
|
algorithm
|
|
Without the guarantee with an algorithm
|
it does not constitute an algorithim- called a procedure
|
|
When finished creating the program (and while creating it), it should be
|
tested with several values (extreme cases)
|
|
is an often overlooked but crucial step in the software development cycle.
|
Testing
|
|
a variable with a fixed value
|
named constants
|
|
public static final Type Variable = Constant;
|
named constants
|
|
named constants are what when declared
|
initialized
|
|
used to name named constants
|
uppercase letters
|
|
use named constants rather than what
|
raw values
|
|
when do you define constants
|
at the begining of the program
|
|
If a literal value is used in a program, changing it’s value requires but named constants are what
|
changing every occurrence in the program.
its value can be changed simply by changing the declaration |
|
used to represent sequences (i.e., strings) of characters
|
the class String
|
|
n a program text beginning and ending with "..." is
|
a string constant
|
|
It is a sequence of characters, but Like other constants, it’s treated as a single item
|
a string constant
|
|
A string can be what
|
empty: ""
|
|
A variable declared to be of type String can store what
|
a string constant
|
|
string is what
string objects are what |
String is a class.
Its instances are String objects |
|
If no value is assigned to a String variable, it has what value
|
null
|
|
In a method, The variable can’t be used in a print statement until what
|
a value has been assigned
|
|
The + operator can be used to what two or more strings together (or string objects and other types of values)
|
concatenate
|
|
String constants and variables can be what
|
mixed
|
|
string + other types of values the result of the operation is what
|
always a String
|
|
A String object stores what
and Unlike a primitive value, the sequence can be |
a sequence of values,
of varying length |
|
The String class defines what that can be what
|
several methods that can be invoked (called)
|
|
returns the number of characters in a particular String object.
|
The length() method
|
|
the method length () returns what
|
an int
|
|
You can use a call to method length() when
|
anywhere an int can be used
|
|
A String is a sequence of character, Each character has what
|
an index (its position)
|
|
positions start with what number
|
0 (not 1)
|
|
a portion of the sequence of characters
|
substring
|
|
returns the character at Index in this string. Index numbers begin at 0
|
charAt(Index)
|
|
Each String object is what
|
immutable (Once created, its text is fixed), however you can change the value of a String variable and new strings can be created from old
|
|
used to tell the compiler that the quotation marks (") do not signal the start or end of a string.
|
escape character (\")
("\"Java\" blah blah.") |
|
escape character= new line- go to the begining of the next line
|
\n
|
|
escape character- carriage return- go to the begining of the current line
|
\r
|
|
escape character- tab- add whitespace up to the next tab stop
|
\t
|
|
Each escape sequence constitutes what even though it is what
|
a single character
typed with 2 symbols |
|
The Unicode character set includes
|
characters from many
different alphabets. |
|
breaking String constants across multiple lines does what
|
causes an error
|
|
can be used to split strings
useful when everything does not fit on one line in the program. |
The concatenation operator (+)
|
|
reads the remainder of the current line, even if it is empty
|
nextLine()
|
|
Often, programs are what to respond to new requirements
|
modified over time
|
|
Programs which are what are easy to modify.
|
easy to read and understand
|
|
Even if the program will be used only once
|
you must read it in order to debug it
|
|
A variable's name should do what
|
suggest its use
|
|
The best programs are what
|
self-documenting (Clean style
and Well-chosen names) |
|
are written into a program as needed explain the program
are used to programs to document the code |
Comments
|
|
Comments are useful to who, but they are ignored by who
|
programer
compiler |
|
a single line comment begins with what
|
//
|
|
is ignored by the compiler in a comment
|
Everything after the // to the end of the line
everything in between the multiline comment |
|
A multiline comment begins and ends with
|
begins with /*
ends with */ |
|
begins with /** and ends with */
|
A javadoc comment
|
|
are used in the comment to describe aspects of the program
|
Special tags
|