AP CSA Unit 2 - Using Objects

studied byStudied by 7 people
0.0(0)
Get a hint
Hint

Object

1 / 46

flashcard set

Earn XP

Description and Tags

47 Terms

1

Object

Entity with data and operations that can manipulate the data

New cards
2

Class

Entity that is either:

1.) Program with only static methods

2.) Custom data type for building objects

New cards
3

Method

A sequence of instructions the object follows to perform a task

New cards
4

Parameter

Information needed by the method to complete the task

New cards
5

Argument

Actual data passed to method

New cards
6

Return Value

The information a method provides

New cards
7

Void

Means NO information is returned

New cards
8

Variable

A storage location in computer’s memory

New cards
9

What are the 3 properties for a Variable?

1.) Type of data being stored

2.) Name (identifier)

3.) Contents (Actual data)

New cards
10

int

For storing integer data

int age = 17;

New cards
11

double

For storing precise number data

double gpa = 3.95;

New cards
12

String

A sequence of characters (text)

System.out.println("Plano West")

New cards
13
term image

Simple Numeric Variables

New cards
14

Assignment Operator (=)

Assigns value (contents) to a variable

variable = value;

New cards
15
term image

Variable Syntax

New cards
16

Declaration

Type name;

New cards
17

Initialization

name = value;

New cards
18

Combined (Declaration & Initialization)

Type name = value;

New cards
19

Identifier

Name of variable, class, or method

New cards
20

Rules for Identifiers

1.) May contain letters, digits (0-9), underscore ( _ ) and dollar sign ($) characters

2.) Cannot start with digit

3.) No spaces are permitted

4.) Cannot be a reserved word

5.) Letters are case-sensitive: west, West, and WEST are different!

New cards
21

Reserved Word

Words defined to have special meaning in Java (Ex: int, public, void)

New cards
22

Java Naming Conventions: Variables and Methods

Starts with first word in all lowercase, subsequent words capitalized: myDogSpot

New cards
23

Java Naming Conventions: Classes

Starts with uppercase letter, each word capitalized: PlanoWestWolf

New cards
24

Java Naming Conventions: Constants

All uppercase letters, separate words with : NUMBER_ONE

New cards
25

Comment

Information for humans (programmers) that the compiler ignores

New cards
26

Single-Line Comment

All information to the right of “//” is ignored

//Single-Line Comment

New cards
27

Multi-Line Comment

All information between “/*” and “*/” is ignored

/*	This is
a multi-line comment
and is all ignored!
*/

New cards
28

Javadoc

Information can be extracted using tool to create documentation

  • Starts with “/**” and ends with “*/

  • Uses special tags like @author, @param and @return

New cards
29

File Heading

A 6-item comment at the top of each source file

<p><span style="font-family: Arial, sans-serif">A 6-item comment at the top of each source file</span></p>
New cards
30

Method Comment Heading

Describes the parts of each method

<p><span style="font-family: Arial, sans-serif">Describes the parts of each method</span></p>
New cards
31

Object Variables

Variable that contains the memory address, or reference, of the object

Its type is the name of a class

New cards
32

Declaring the Object

Designate a name for referring to the object

ClassType name;

New cards
33

Instantiation

Building (constructing) an object by calling on a class’ constructor

name = new ClassType();

Some constructors accept parameters – allowing us to specify initial values

Rock mossy = new Rock(Color.GREEN);

Some constructors accept multiple parameters

Location loc;
loc = new Location(5, 7);

New cards
34

Calling Methods

After instantiating your object, you can call, or invoke, its methods

New cards
35

Public Interface

The methods defined by a class for public use

New cards
36

API (Application Programming Interface)

Defines the public interface for classes and methods in the Java library

New cards
37

Return Method

A method that returns a value when called

New cards
38

Void Method

A method that does not return information

New cards
39

Accessor Method

Does not change the object’s data

New cards
40

Mutator Method

Changes the object’s data

New cards
41
term image

Calling Methods With Objects

New cards
42
term image

Calling Return Methods With Objects

New cards
43

Package

A grouping of logically-related classes

New cards
44

Import Statement

Identifies a class defined in a different package

New cards
45

Overload

Method is defined multiple ways

New cards
46

Concatenation

Joining two strings together to form a new string

<p><span style="font-family: Arial, sans-serif">Joining two strings together to form a new string</span></p>
New cards
47

int length()

Returns the number of characters (visible + white space) in the string

String school;
school = new String("Plano West");
int count = school.length();
// Returns as 10

New cards

Explore top notes

note Note
studied byStudied by 9 people
... ago
4.0(1)
note Note
studied byStudied by 10 people
... ago
5.0(1)
note Note
studied byStudied by 106 people
... ago
5.0(1)
note Note
studied byStudied by 12 people
... ago
4.0(1)
note Note
studied byStudied by 139 people
... ago
4.0(1)
note Note
studied byStudied by 11 people
... ago
4.0(1)
note Note
studied byStudied by 64 people
... ago
5.0(1)
note Note
studied byStudied by 5 people
... ago
5.0(1)

Explore top flashcards

flashcards Flashcard (52)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (44)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (330)
studied byStudied by 58 people
... ago
5.0(1)
flashcards Flashcard (103)
studied byStudied by 12 people
... ago
5.0(3)
flashcards Flashcard (117)
studied byStudied by 9 people
... ago
5.0(1)
flashcards Flashcard (51)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (107)
studied byStudied by 1 person
... ago
5.0(1)
robot