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

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;

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;
Scanner keyboard = new Scanner(System.in);

System.out.print("What is your hourly pay rate? ");
payRate = keyboard.nextDouble();

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};
For(int val : numbers)
{
System.out.println("The next value is" + val);
}

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");
Scanner inputFile = new Scanner(myFile);

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:
"11-22-2007"

the String class has a method split that?

Tokenizes a String and returns an array of String objects.