• 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/33

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;

33 Cards in this Set

  • Front
  • Back
What must you do to instantiate writing to a file object?
PrintWriter writer = new PrintWriter(new FileWriter("outfile.txt"));
What must you do after writing to a file?
writer.close();
How must you declare that you might get an error related to reading and writing from files?
throws IOException in method heading
What must your code look like to read from a file?
Scanner filescan = new Scanner(new FileReader('infile.txt"));
How must you instantiate a Random object?
Random random = new Random();
What is the javadoc format?
/**
Description
@param
@return
*/
What happens when a primitive variable is passed to a method?
CANNOT CHANGE THE CORRESPONDING VARIABLE IN MAIN FROM WITHIN THE METHOD
What happens when an object reference is passed to a method?
-parameter variable points to the original object
-changes made in the method are permanent
Instance methods are called with ______
class object and may interact directly on instance data methods
Static methods are called with ______
the class name (does not need any instance methods to do its job because it is stand alone)
The reference variable holds the ______, whereas the object holds ______
memory location of the object; the actual data
What methods does the Object class in Java contain?
clone ()
toString ()
equals()
Array indices must start at __
0
We must declare a ___ to create
size capacity
______ tells us the declared size of an array
.length
How do you declare an array of ints carrying 20?
int ra = new int[20];
How do you access first index and set it to 23?
ra[0] = 23;
How do you initialize an array in one line?
int hw[] = {45, 65, 32}
int [][] ra (which one is columns and which rows?
first is rows
second is columns
What does .length mean for two dimensional arrays?
number of rows
How efficient are the various sorting methods?
Bubble sort: n^2
selection sort: n^2
merge sort: n log n
How efficient are the searching methods?
Binary search: log n
linear search: n
What is method overloading?
Same name. different parameters
What is method overriding?
Same name, Same parameters
What does extends mean?
subclass extends base class
What does super mean?
to call base class constructor or over-ridden method in base class
What does instanceof mean?
to see if an object belongs to a specific class
What does protected mean?
to give access to derived classes
What does implements mean?
to say a class will have a method definitions to support an interface
What is the method that is in the Comparable class?
int compareTo(Object o)
returns negative int if < param, positive int if > param, 0 if the same
How should you display error messages?
System.err.print()
If operation throws an exception that is not caught, what will happen?
program will stop and printStackTrace
What are unchecked Exception classes?
RuntimeException
NullPointerException
InputMismatchException