01 Prelim CP2 Flashcards

1
Q

a programming methodology that
defines objects whose behaviors and
interactions accomplish a given task

A

Object-Oriented Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

> represents either a REAL-WORD OBJECT or
an ABSTRACTION

> has CHARACTERISTICS or ATTRIBUTES
- Attributes are what objects POSSESS or HAVE

> has STATES

> has BEHAVIOR (METHODS)

> Example: Car

A

Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

> defines a KIND of object

> a BLUEPRINT for DEFINING the objects

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

> enables NEW objects to take on the
PROPERTIES of existing objects

> used to AVOID REPETITIION of programming instructions for each class

> makes use of the EXTENDS keyword

A

Inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Under Inheritance:

> (1)______ is used as the basis of
inheritance.
(2)_______ inherits from a superclass.

Usage:
public class Car extends Vehicle

Superclass: Vehicle
Subclass: Car

A
  1. Superclass
  2. Subclass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What sample of code syntax is this:

/**An _______ for methods that return the
parameter and area of an object **/

public interface Measurable
{

 //Returns the perimeter
 public double getPerimeter();

 //Returns the area
 public double getArea();

}

A

Interface sample syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

> contains the HEADINGS for a NUMBER of PUBLIC METHODS

> can also define PUBLIC NAMED CONSTANTS

> uses the keyword IMPLEMENTS

SYNTAX:
public interface Interface_Name

USAGE:
public class Rectangle implements Measurable

Interface: Measurable

A

Interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Syntax for Interface:

A

public interface Interface_Name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Sample usage of Interface:

A

public class Rectangle implements Measurable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

> a COLLECTION of related classes and
interfaces that have been GROUPED
together into a FOLDER

> used with the IMPORT keyword

A

Package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Syntax for package:

A

package package _name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

PACKAGE

Note: It typically consists of all (1)______
letters, often punctuated with the (2)_____
symbol.

Sample:
package java.util;

A
  1. lowercase
  2. Dot
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Package

Syntax for the import statement:

A

import package_name.class_name_or_asterisk;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Package sample usage:

A

import java.util.Scanner;
import java.util.*;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What keyword should you use for Inheritance?

A

extends

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What keyword should you use for Interface?

A

implements

17
Q

What keyword should you use for the package?

18
Q

The data type of an object is the name of its ________.

Example Object: Car
Example Object of the same kind: Motorcycle, Truck and
Bus

19
Q

Objects of the same kind are said to have the same (1)_____ ____ and belong to the same (2)_____.

A
  1. Data type
  2. Class
20
Q

Example Object: Car
Example Object of the same kind: Motorcycle, Truck and Bus

What is the name of its class?

21
Q

You can use all the classes that are in a package within any program or class definition by placing an _______ statement.

22
Q

For the package/import statement:

Is it a requirement to have the class in the same folder with the classes in the package?

A

NO. The class DOES NOT NEED to be in the same folder with the classes in the package.