Computer Science A Unit 3

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/39

flashcard set

Earn XP

Description and Tags

Unit 2 Us objects Strings and class types Escape Sequences and String Concatenation String Methods Classes and Objects Using Constructors Using Methods Math Functions

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

40 Terms

1
New cards

Primitive data types

Hold only one piece of data at a time

Boolean, int, double

stored as an actual value

2
New cards

Reference data type (class)

hold more than one piece of data type

Int, double, String, Scanner

have built-in tools - tools which you can use to work with an manipulate data

memory address that points to the place where info is stored (don’t site the actual value)

3
New cards

Strings are immutable

means you cannot change Strings without moving to a new memory location. Java will do this automatically.

4
New cards

null

Placeholder that means no reference

5
New cards

Order of operations

Rules that tell us the sequence in which the code is run

6
New cards

String memory

Each character of a String is stored individually

Each character is given an address that starts at 0

7
New cards

index

The address number of each character

8
New cards

.length() method

Tells us the length of the String

9
New cards

.equals() method

Tests if 2 strings are equal - If the same contents of both Strings heave the same characters in the same places

Will return the true or false (Boolean)

10
New cards

.substring(start, stop) method

Creates a subset of characters from the starting index up to but not including the stopping index

11
New cards

.substring (start)

Returns the subset of characters from the start to the end of the String

12
New cards

.toUpperCase() method

Returns the String changed to the uppercase letters

13
New cards

.toLowerCase()

Returns the string changed to the lowercase letters

14
New cards

.compareTo() method

Lets us compare 2 Strings alphabetically

15
New cards

.indexOf() method

Method that allows you to search through a String to find a particular character

Returns the index position as an int

16
New cards

Object

Specific instance of a class with defined attributes

17
New cards

Instance variables

Define true attributed for objects

18
New cards

Attributes

Store and represent data associated with objects whose behaviors are defined by the methods

19
New cards

Instance

Specific object that is created from the class

20
New cards

Constructing

The process of creating a new object

21
New cards

Constructor

Special method that creates a new object

Every class defines its own constructor

Doesn’t have a return type in Java

22
New cards

Parameter

Information we put in () and determines how we construct our new object

23
New cards

API

Application Programming Interface

It’s the way programmers share information or code with each other

24
New cards

State

Attributes of the object and their values (at a given time) that define what our object (ex: rectangle) looks like

25
New cards

setRadius() method

Characteristics of a circle: round, radius, diameter, circumference, pi

True for the Circe class

26
New cards

Void methods

Performs an action, but doesn’t return any information

Generally changes the state of an object

27
New cards

Non-void methods

Changes the state of an object and returns a value to us

Mostly used for pulling information for an object

28
New cards

Method overloading

By quantity (number of parameters)

By data type

By different order

29
New cards

Method Signature

Made up of methods name, number of parameters, and the data type of those parameters

Java determines which method to call based on parameter number and number and data types - the method signature

Signatures can only have the same name - those are overloaded methods - but they have to be different parameters

30
New cards

Wrapper class

Wraps a primitive data type into objects/class so we can apply methods to them

31
New cards

CompareTo() method

Compare 1 integer to another integer

Compares 1 double to another double

32
New cards

Autoboxing

Automatic conversion between primitive data types and their corresponding object wrapper classes

33
New cards

Unboxing

When java is given an Integer and expects an int, it automatically converts, or unboxes, the integer into a primitive int.

34
New cards

Math Class

Part of Java.lang package

We need to make sure it is imported to our program

35
New cards

Math.abs() method

Performs an absolute value calculation

int the as an input→ int as an output

double used → double returned

36
New cards

.pow(x,y) method

Performs exponent math

Accepts 2 parameters: the base and the exponent

Performs a calculation: base (x) raised to the exponent power (y)

37
New cards

.sqrt() method

Calculates the square root of the double we send it

Returns a double

38
New cards

math.random()

Returns a double from 0.0 to but not including 1.0

39
New cards
<p>non-static methods</p>

non-static methods

Specify the object, then the method to perform on the object

40
New cards
<p>Static methods</p>

Static methods

Performed just by referencing the Class name