Ap JAVA semester 1 final

0.0(0)
studied byStudied by 2 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/45

flashcard set

Earn XP

Description and Tags

WIP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

46 Terms

1
New cards

Attributes

Instance variable, properties of object. Ex: Class = dog, attributes = color, breed, age

2
New cards

Behavior

methods (ex: turnLeft() )

3
New cards

Case sensitive

Uppercase vs - lowercase. HELLO is diff than hello

4
New cards

Run-time error

logic error, ex in painter there is a paint command but they are out of paint

5
New cards

Variable

attribute

6
New cards

Primitive type

predefined. no capitalization. int, double, char, boolean.

7
New cards

Parameter

variable in method constructors ex: color in public void paint(String color){

8
New cards

Argument

value of the parameter. ex: “white” in painter.paint(“white”);

9
New cards

Void method

does not have a return type, instead does an action.

10
New cards

Encapsulation

combining data and functions, etc, into one class. Basically using private with get and set methods

11
New cards

Constructor

Public method for instantiating an object. Ex: public Dog(int age, String breed){

12
New cards

Truncation

int divided by an int slices off the decimal instead of rounding

13
New cards

Concatenation

slapping to strings together. Can use +=

14
New cards

int/0 vs double/0

double will return infinity, int will make your planes explode

15
New cards

compound assignment operator

shortcuts. +=, -=, *=. Ex: if int a = 4, a+= 6 will yield 10. same as a = a + 6

16
New cards

mod operator

%. gives you the truncated remainder

17
New cards

casting

assign a value of one type to another. Ex: int num = (int) 5.2; //num is now 5

18
New cards

math random

(int)(Math.random() * range) + min

19
New cards

object class

superclass

20
New cards

toString()

to return an object in string format to be readable. Ex: public String toString(){ return variable + “ “;}

21
New cards

escape sequences

\n = new line, \\ = backslash, \” = double quote

22
New cards

parsing

dividing texts into different parts w/substring

23
New cards

.compareTo

returns the int value of subtracting the two strings

24
New cards

class methods

can be called without creating a class object

25
New cards

instance methods

method that requires an object of a class to be created to be called

26
New cards

static

in class methods

27
New cards

overloading

defining two or more constructors with the same name but different signatures

28
New cards

iteration statement

statements that repeatedly perform a block of code. Ex: while

29
New cards

selection statement

statements that perform a block of code once under certain circumstances. if statements

30
New cards

demorgans laws

!(A && B) = !A || !B. !> is <=, !< is >=, vise versa

31
New cards

alias

a different name assigned to the same object. They are strings that are ==

32
New cards

non alias

different objects with the same name. These use .equals

33
New cards

for loops

(ex:) for(int i = #; i<#; i++){code}

34
New cards

abstraction

condensing/simplifying, like classes with constructors being created in a class, or assigning variables names like int age = 76 for ex

35
New cards

accessor methods

get() method

36
New cards

mutator methods

set() method

37
New cards

reference variable

an object created with all its attributes being its own thing when stored as an object.

38
New cards

shadowing

local (private) variables shadow global (public) variables with the same name. Basically just giving it a default I guess

39
New cards

returns character index

.charAt()

40
New cards

see if one string has the same sequence of characters

.contains()

41
New cards

find number character is at

indexOf()

42
New cards

find last number character is at

.lastIndexOf()

43
New cards

get actual length

.length()-1;

44
New cards

floor

floor(x), rounds down, returns double

45
New cards

ceiling

ceil(x), rounds up, returns double

46
New cards

== vs =

== for checking something (returning a boolean). ex: if(a == b). = for setting equal