Computer Science A Unit 3

studied byStudied by 1 person
0.0(0)
get a hint
hint

Primitive data types

1 / 39

Tags and Description

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 16 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 13 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 13 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 14 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 1609 people
Updated ... ago
4.8 Stars(6)

Explore top flashcards

flashcards Flashcard65 terms
studied byStudied by 16 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard103 terms
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard191 terms
studied byStudied by 6 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard53 terms
studied byStudied by 10 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard198 terms
studied byStudied by 27 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard31 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard91 terms
studied byStudied by 31 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard94 terms
studied byStudied by 35 people
Updated ... ago
5.0 Stars(1)