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;
32 Cards in this Set
- Front
- Back
Objects consist of |
Attributes and methods |
|
Objects represent |
State: Value of all attributes Behavior: What actions it can perform, defined by methods. |
|
A Class is composed of |
A name, attributes, and operations |
|
If there is more then one Class in a file then... |
only one can be public and it must match the name of the file. |
|
The Job of a constructor is? |
allocate memory and initialize fields of a new object. |
|
what do Accessors and mutators do? |
Get and set fields of an object |
|
Encapsulation |
Enclosing the proper attributes and method in a single class |
|
in UML diagrams variable types are placed... |
after the variable name. |
|
in UML diagrams return types are placed... |
after the method name. while variables are placed inside. |
|
The class that starts the application must have? |
A main method. Can be used as a driver. |
|
A driver program does what? |
Tests or runs the application. Makes all the classes interact as needed. |
|
To read input from a keyboard |
We use the scanner class. import java.util.Scanner; |
|
To use a scanner... |
Double payRate; |
|
an instance field is? |
A variable created in the class but not in a method. |
|
The keyword final creates? |
Constant variables |
|
Constructors have what special properties |
-Same name as class -No return type(not even void) -typically public |
|
Default constructor does what? |
-Sets numeric fields to 0 -sets boolean fields to false -sets reference variables to null |
|
Can a constructor use this in a constructor to call another constructor |
yes. Must be first statement in the constructor. |
|
An enhanced for loop has the form... |
int[] numbers = {3, 6, 9}; |
|
What needs to happen to an array of objects? |
Each needs to be intialized |
|
ragged array? |
When rows of a 2D array are of different lengths |
|
An array list has a default capacity of? |
10 |
|
to open a file for output... |
create an instance of PrintWriter class. PrintWriter outputFile = new PrintWriter("StudentData.txt"); |
|
To append text to a file... |
create a FileWriter class. then create PrintWriter PrintWriter outputFile = new PrintWriter("StudentData.txt"); PrintWriter outputFile = new PrintWriter(fw); |
|
To read data from a file you use? |
File class and the Scanner class. File myFile = new File("Customers.txt"); |
|
Wrapper classes are provided for? |
All primitive data types: byte, double, float, int, long, and short. |
|
what is Autoboxing and Unboxing? |
declaring a wrapper class variable and assigning a value or vice versa. |
|
Wrapper classes are? |
Immutable and thus once the object is created it cannot be changed. |
|
A StringBuilder class allows? |
the contents to be changed: change specific char, insert char, etc |
|
A StringTokenizer does what? |
breaks a string down into parts or tokens. |
|
Tokens are? |
a series of words or other items of data separated by spaces or other characters(delimiter). Example-date: |
|
the String class has a method split that? |
Tokenizes a String and returns an array of String objects. |