Computer Science A Unit 3

studied byStudied by 1 person
0.0(0)
Get a hint
Hint

Primitive data types

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

40 Terms

1

Primitive data types

Hold only one piece of data at a time

Boolean, int, double

stored as an actual value

New cards
2

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)

New cards
3

Strings are immutable

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

New cards
4

null

Placeholder that means no reference

New cards
5

Order of operations

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

New cards
6

String memory

Each character of a String is stored individually

Each character is given an address that starts at 0

New cards
7

index

The address number of each character

New cards
8

.length() method

Tells us the length of the String

New cards
9

.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)

New cards
10

.substring(start, stop) method

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

New cards
11

.substring (start)

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

New cards
12

.toUpperCase() method

Returns the String changed to the uppercase letters

New cards
13

.toLowerCase()

Returns the string changed to the lowercase letters

New cards
14

.compareTo() method

Lets us compare 2 Strings alphabetically

New cards
15

.indexOf() method

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

Returns the index position as an int

New cards
16

Object

Specific instance of a class with defined attributes

New cards
17

Instance variables

Define true attributed for objects

New cards
18

Attributes

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

New cards
19

Instance

Specific object that is created from the class

New cards
20

Constructing

The process of creating a new object

New cards
21

Constructor

Special method that creates a new object

Every class defines its own constructor

Doesn’t have a return type in Java

New cards
22

Parameter

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

New cards
23

API

Application Programming Interface

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

New cards
24

State

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

New cards
25

setRadius() method

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

True for the Circe class

New cards
26

Void methods

Performs an action, but doesn’t return any information

Generally changes the state of an object

New cards
27

Non-void methods

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

Mostly used for pulling information for an object

New cards
28

Method overloading

By quantity (number of parameters)

By data type

By different order

New cards
29

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

New cards
30

Wrapper class

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

New cards
31

CompareTo() method

Compare 1 integer to another integer

Compares 1 double to another double

New cards
32

Autoboxing

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

New cards
33

Unboxing

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

New cards
34

Math Class

Part of Java.lang package

We need to make sure it is imported to our program

New cards
35

Math.abs() method

Performs an absolute value calculation

int the as an input→ int as an output

double used → double returned

New cards
36

.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)

New cards
37

.sqrt() method

Calculates the square root of the double we send it

Returns a double

New cards
38

math.random()

Returns a double from 0.0 to but not including 1.0

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

non-static methods

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

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

Static methods

Performed just by referencing the Class name

New cards

Explore top notes

note Note
studied byStudied by 33 people
... ago
5.0(1)
note Note
studied byStudied by 54 people
... ago
5.0(2)
note Note
studied byStudied by 57 people
... ago
5.0(1)
note Note
studied byStudied by 133 people
... ago
4.8(4)
note Note
studied byStudied by 11 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 2929 people
... ago
5.0(3)

Explore top flashcards

flashcards Flashcard (305)
studied byStudied by 23 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 34 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (130)
studied byStudied by 13 people
... ago
4.0(1)
flashcards Flashcard (154)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (88)
studied byStudied by 26 people
... ago
5.0(1)
flashcards Flashcard (84)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (32)
studied byStudied by 23 people
... ago
5.0(1)
robot