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;
72 Cards in this Set
- Front
- Back
class
|
1) a Java reserved word used to define a class
2) the blueprint of an object- the model that defines the variables and methods an object will contain when instantiated |
|
instance
|
-an object created from a class
-multiple objects can be instantiated from a single class |
|
instance method
|
-a method that must be invoked through a particular instance of a class, as opposed to a class method
|
|
instance variable
|
-a variable that must be referenced through a particular instance of a class, as opposed to a class variable
|
|
class method
|
-a method that can be invoked using only a class name
-an instantiated object in not required as it is with instance methods |
|
"static"
|
the reserved word in java which is used to define a class method and a class variable
|
|
class variable
|
-a variable that is shared among all objects of a class
-it can also be referenced through the class name, w/o instantiating any object of that class |
|
object
|
1) primary software construct in the object-oriented paradigm
2) an encapsulated collection of data variables and methods 3) an instance of a class |
|
variable
|
an identifier in a program that represents a memory location in which a data value is stored
|
|
compiler
|
a program that translates code from one language to equivalent code in another language
-Java compiler translates Java source code into Java bytecode |
|
interpreter
|
-a program that translates and executes code on a particular machine
-the Java interpreter translates and executes Java bytecode |
|
what does each object have?
|
each ___ has a state, defined by its attributes, and a set of behaviors, defined by its methods
|
|
\b
|
backspace
|
|
\t
|
tab
|
|
\n
|
newline
|
|
\r
|
carriage return
|
|
\"
|
double quote
|
|
\'
|
single quote
|
|
\\
|
backslash
|
|
escape sequence
|
used to represent a character that would otherwise cause compilation problems
|
|
constant
|
identifiers which hold a particular value for the duration of their existence
|
|
the eight primitive data types
|
the following are what?
1)four subsets of integers- byte, short, int, long 2)two subsets of floating point- float, double 3)a character data type- char 4)a boolean data type- boolean |
|
"byte"
|
8 bits of storage space (min value: -128, max value: 127)
|
|
"short"
|
-two byte integer
-16 bits -min value: -32,768 -max value: 32, 767 |
|
"int"
|
-32 bits
-min value: -2,150,000,000 -max value: 2, 150,000,000 -Java assumes all integer literals are of this type |
|
"long"
|
-64 bits
-min val: -9,200,000,000,000,000,000 -max val: 9,200,000,000,000,000,000 -integer is recognized as not "int" if it has an "L" or "l" appended to end |
|
"float"
|
-32 bits
-min val: approx -3.4E+38, w 7 sig digit -max val: approx 3.4e+38 w 7 sig digits -point literals with "F" or "f" attached to end |
|
"double"
|
-64 bits
-min val: apprx -1.7E+308 w 15 sig digit -max val: apprx 1.7E+308 w 15 sig digit -point literals with "D" or "d" attached to end |
|
"char"
|
-American Standard Code for Information Interchange uses 7 bits per character, providing room for 128 characters
-uppercase letters -lowercase letters -punctuation (.,;) -digits 0-9 -special symbols (&|\) -control characters (carriage return, null, end-of-text marks) |
|
"boolean"
|
-only two valid values: "true" and "false"
-used to indicate if a particular condition is true -can be used to represent any situation that has two states |
|
"/"
|
divides, returning the whole number
|
|
"%"
|
divides, returning the remainder
|
|
operator precedence
|
1)parentheses
2)multiplication, division, remainder operator 3)addition, subtraction |
|
-unary plus and unary minus
-assignment (precedence associates) |
Right to Left
|
|
-multiplication, division, remainder
-addition, subtraction, string concatenation (precedence associates) |
Left to Right
|
|
"count++;" and "++count;" is same as
|
"count=count+1;" is same as
|
|
"total += 5;" is same as
|
"total = total + 5;" is same as
|
|
"result *= count1 + count2;" is same as
|
"result = result * (count1+count2);" is same as
|
|
Scanner (InputStream source)
Scanner (File source) Scanner (String source) |
constructors: sets up the new scanner to scan values from the specified source
|
|
String next()
|
returns the next input token as a character string
|
|
String nextLine()
|
returns all input remaining on the current line as a character string
|
|
boolean nextBoolean()
byte nextByte() double nextDouble() float nextFloat() int nextInt() long nextLong() short nextShort() |
-returns the next input token as the indicated type
-throws "InputMismatchException" if the the next token is inconsistent with the type |
|
boolean hasNext()
|
returns true if the scanner has another token in its input
|
|
Scanner useDelimiter(String pattern)
Scanner useDelimiter(Pattern pattern) |
sets the scanner's delimiting pattern
|
|
Pattern delimiter()
|
returns the pattern the scanner is currently using to match the delimiters
|
|
String findInLine (String pattern)
String findInLine (Pattern pattern) |
attempts to find the next occurenc of the specified pattern, ignoring delimiters
|
|
"new" operator
|
returns a reference to a newly created object
|
|
"String" object
|
-once created, cannot be lengthened or shortened, and is ergo considered immutable
-the first character is numbered 0 |
|
String (String str)
|
constructor: creates a new string object with the same characters as "str"
|
|
char charAt (int index)
|
returns the character at the specified index
|
|
int compareTo (String str)
|
returns an integer indicating if this string is lexically before (a negative return value), equal to (a zero return value), or lexically after (a positive return value), the string "str"
|
|
String concat (String str)
|
returns a new string consisting of this string concatenated with "str"
|
|
boolean equals (String str)
|
returns true if this string contains the same characters as str (including case) and false otherwise
|
|
boolean equalsIgnoreCase (String str)
|
returns true if this string contains the same characters as str (w/o regards to case) and false otherwise
|
|
int length()
|
returns the number of characters in this string
|
|
String replace (char oldChar, char newChar)
|
returns a new string that is identical with this string except that every occurance of oldChar is replaced by newChar.
|
|
String substring (int offset, int endIndex)
|
returns a new string that is a subset of this string starting at index offset and extending through endIndex-1.
|
|
String toLowercase()
|
returns a new string identical to this string except all uppercase letters are converted to their lowercase equivalent
|
|
String toUppercase()
|
returns a new string identical to this string except all lowercase letters are converted to their uppercase equivalent
|
|
in order to use a method of a class you must ___
|
to ___ you must invoke it with the form variable._____
|
|
java.applet package
|
provides support to create programs (applets) that are easily transported accross the Web
|
|
java.io package
|
provides support to perform a wide variety of input and output functions
|
|
java.lang package
|
provides general support; it is automatically imported into all Java programs
|
|
java.math package
|
provides support to perform calculations with arbitrarily high precision
|
|
java.text package
|
provides support to format text for output
|
|
java.util package
|
provides support for general utilities
|
|
Random ()
|
Constructor: creates a new pseudorandom number generator
|
|
float nextFloat ( )
(method in Random class) |
returns a random number between 0.0 (inclusive) and 1.0 (exclusive)
|
|
int nextInt ( )
(method in Random class) |
returns a random number that ranges over all possible int values (positive and negative)
|
|
int nextInt (int num)
(method in Random class) |
returns a random number in the range 0 to num-1
|
|
Random class is part of which class
|
___ is part of the java.util class
|
|
2 methods of the NumberFormat class
|
getCurrencyInstance() -returns a NumberFormat object that represents a currency format for the current locale
getPercentInstance() -returns a NumberFormat object that represents a percentage format for the current locale |