• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/67

Click to flip

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;

67 Cards in this Set

  • Front
  • Back

instance methods

requires that an instance of a class be created in order to be used


static fields/methods

the class name rather than the instance name is used

static fields

declared using the static keyword between the access specifier and the field type

static methods

declared by placing the static keyword between the access modifier and the return type of the method


necessary to create an instance of the class in order to use the method


may be called at the class level


typically used to create utility classes such as the MATH class


may not communicate with instance fields

passing objects as arguments

passes value of the reference variable

reference variable value

an address or reference to the object in memory


a copy to the object is not passed, just a pointer to the object


possible for the method to modify the contents of the object referenced by the variable

returning objects from methods

methods can return references to objects as well as primitive data types


a copy of the argument is not returned, only its address


toString method

can be called explicitly


called implicitly when you pass an object of the class to println or print and when you concatanate an object of the class with a string


all objects have this method that returns the class name and a hash of the memory address of the object


the default method can be overridden with your own to print more useful info


equals method

when the == operator is used with reference variables, the memory address of the object are compared, the contents of the objects are not compared


all objects have this method


the default operation of this method is to compare memory addresses of the objects just like ==

methods that copy objects

reference only copy


deep copy

reference only copy

copying the address of an object into another reference variable


deep copy

involves creating a new instance of the class and copying the values from one object into the new object

copy constructors

accepts an existing object of the same class and clones it

aggregation

creating an instance of one class as a reference in another class


creates a "has a" relationship between objects

returning reference variables to private fields

avoid returning reference to private data elements


returning references to private data objects will allow any object that receives the reference to modify the variable

null references

a reference variable that points to nothing


and no operations can be performed on it


references can be tested to see if they point to this prior to use

this reference

reference that is a name that an object can use to itself and can be used to overcome shadowing and allow a parameter to have the same name as an instance field



can be used to call a constructor from another constructor



enumerated types

specialized class



known as enum, requires declaration and definition like a class



enum typename( one or more enum constants)

enumerated types - methods

toString



ordinal



equals



comareTo

toString

returns name of calling constant

ordinal

returns the zero-based position of the constant in the enum.

equals

accepts an object as an argument and returns true if the statement is equal to the calling enum constant

comparTo

accepts an object as an argument and returns a negative integer if the calling constant's ordinal<than the argument's ordinal, a positive integer if the calling constant's ordinal >than the argument's ordinal and zero if the calling constants ordinal == the argument's ordinal

switching

allows you to test an enum constant with a switch statement

garbage collection

when objects are no longer needed, they are destroyed, freeing up memory they consumed


java handles all memory operations


set the reference to null and java will reclaim memory



the JVM has a process that runs in the background that reclaims memory from released objects


will reclaim memory from any object that no longer has a valid reference pointing to it


finalize method

will run just prior to the garbage collector reclaiming its memory


the garbage collector is a background thread that runs periodically


it cannot be determined when the method will actually run

class collaboration

two classes ineract with each other


an object must know something about the second object's methods and to call them


CRC cards

Class, Responsibilities, and Collaborations cards are useful for determining and documenting a class's responsibilities



things a class is responsible for doing and knowing

primitive data types

not created from classes


wrapper class

provided for all primitive data types and is a class that wraps around a primitive data type


part of the java.lang so no import statement is needed to use them



this class allows you to create objects to represent a primitive data types


they are immutable(cannot be changed)


to get the value stored in an object, you must call a method


wrapper classes provide static methods that are very useful




Character Class

is a wrapper class for the char data type, provides numerous methods for testing and converting character data


allows a char data type to be wrapped in an object


static character class methods

1. isDigit


2. isLetter


3. LetterorDigit


4. isLowerCase


5. isUpperCase


6. isSpaceChar


7. isWhiteSpace

Substrings

used to refer to a string that is part of another string

startWith/ endsWith method

determines whether a string begins with a specified substring.


is a case sensitive comparison

regionMatches method

determines whether specified regions of two strings match

index of/last index of methods

locates the position of the substring


will return the location of a substring or character in the calling String object

extracting substrings

allows you to retrieve a substring from a string

substring method

returns a copy of a substring from a calling object..... two methods


1. accepts an int argument that is the starting position of the substring


2. accepts two int arguments. the first specifies the substring's starting position and the second specifies the substring's ending position


getChars method

stores a substring in a char array

toCharArray

returns the string objects contents in an array of char values


extracting characters to arrays

the String class provides method to extract substrings in a String object and store them in char arrays

returning modified Strings

the String class provides methods to return modified String objects

concat

returns a String object that is the concatenation of two String objects

replace

returns a String object with all occurrences of one character being replaced by another character

trim

returns a String object with all leading and trailing whitespace characters removed

valueOf methods

accepts a value of any primitive data type as its arguments and returns a string representation of the value

StringBuilder class

similar to the String class except you may change the contents of StringBuilder objects


A StringBuilder object can grow or shrink in size as needed to accomodate the changes

StringBuilder append method

The StringBuilder class has several overloaded versions of this method which accepts an argument of any primitive data type, char array, or string object.

StringBuilder insert methods

StringBuilder has several overloaded version of this method which insert a value in the calling objects string. This method accepts two arguments:


1. int specifying the position in the calling method


2. value inserted

StringBuilder replace method

replaces a specified substring with a string

StringBuilder delete, deleteCharAt, and setCharAt methods

used to delete a substring or a character from a StringBuilder object

StringBuilder toString method

method used to convery StringBuilder object to a regular String

StringTokenizer class

breaks a string down into its components called tokens


provided by java api so an import statement mus be used

Tokens

series of words or other items of data seprated by spaces or other characters

delimeter

character that separates tokens


white spaces are used by default for this

tokenizing

process of breaking a sting into tokens is known as tokenizing


non-default delimiters

the string class trim method should be used on user input strings to avoid having whitespace become part of the last token

multiple delimiters

to extract the tokens from the string, we must specify both characters as delimiters to the constructor

String class split method

Tokenizes a String object and returns an array of String objects

numeric data type wrappers

Java provides wrapper classes for all of the primitive data types

creating a wrapper object

pass a value to the constructor and assign a primitive value to a wrapper class object

parse methods

each of the numeric wrapper classes has a static method that converts a string to a number


this method throws a NumberFormatException if the String object does not represent a numeric value


wrapper class toString method

wrapper class static method that converts a number to a String


The method accepts the numbers as its argument and returns a string representation of that number

wrapper class toBinaryString, toHexString, and toOctalString methods

accept an int or long as an argument and convert them to binary, hexadecimal, or octal

min_value and max_value

the numeric wrapper classes each have a set of final variables which hold the minimum and maximum values for a particular data type

autoboxing

process of automatically boxing up a value inside an object


will allow you to use ArrayLists with primitives which would otherwise only work with objects

unboxing

process of converting a wrapper class object to a primitive data type


will allow you to use ArrayLists with primitives which would otherwise only work with objects