AP CSA Unit 2: Objects

studied byStudied by 286 people
5.0(2)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 15

flashcard set

Earn XP

Description and Tags

16 Terms

1

object

a data type that is created in Java

New cards
2

Math class

stores common numbers used in mathematical calculations and methods that have mathematical functions

New cards
3

static method

belong to a class but not to any instances of that specific class

can be called without class’s instance or object

New cards
4

Math.abs(x)

gets the absolute value of ‘x’ ; the return value is always positive

New cards
5

Math.pow(x,y)

does ‘x’ to the power of ‘y’ (x^y); the answer will always be a double(decimal) value

New cards
6

Math.PI

stores the value for pi: 3.141592653…

New cards
7

charAt(int x)

returns the char at the given index of ‘x’

New cards
8

contains(String s)

returns true when received string is within the called string, false otherwise

New cards
9

endsWith(String s)

returns true when received string ends with called string, false otherwise

New cards
10

equals(String s)

returns true when the two strings are equal, false otherwise

New cards
11

equalsIgnoreCase(String s)

returns true when the two strings are equal ignoring the case( lower or upper), false otherwise

New cards
12
public class Example{
public static void main(String[] args){
String s = "I like apples";
String g = "ILIKEAPPLES";
//What is returned from this line of code?
System.out.println(s.equals(g));
}
}

false

New cards
13
public class Example{
public static void main(String[] args){
String s = "I like apples";
String g = "ILIKEAPPLES";
//What is returned from this line of code?
System.out.println(toLowerCase(g));
}
}

ilikeapples

New cards
14
public class Example{
public static void main(String[] args){
int x = 2;
int y = 10;

int z = Math.pow(y,x);
System.out.println(z);
}
}

100.00

New cards
15
public class Example{
public static void main(String[] args){
int x = 2;
int y = -10.9;

int z = Math.abs(y);
//what is printed from this program
System.out.println(z);
}
}

10.9

New cards
16
public class Example{
public static void main(String[] args){
String hi = "hello, John Harvard";

//what is printed from this program?
System.out.println(hi.charAT(7));
}
}

J

New cards

Explore top notes

note Note
studied byStudied by 8 people
852 days ago
5.0(1)
note Note
studied byStudied by 84 people
655 days ago
5.0(2)
note Note
studied byStudied by 86 people
409 days ago
5.0(1)
note Note
studied byStudied by 9 people
814 days ago
5.0(1)
note Note
studied byStudied by 27 people
740 days ago
5.0(1)
note Note
studied byStudied by 37 people
648 days ago
5.0(1)
note Note
studied byStudied by 66 people
762 days ago
4.5(4)
note Note
studied byStudied by 1120 people
139 days ago
4.9(9)

Explore top flashcards

flashcards Flashcard (100)
studied byStudied by 2 people
313 days ago
5.0(1)
flashcards Flashcard (339)
studied byStudied by 15 people
400 days ago
5.0(1)
flashcards Flashcard (52)
studied byStudied by 6 people
501 days ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 54 people
782 days ago
5.0(1)
flashcards Flashcard (51)
studied byStudied by 28 people
377 days ago
5.0(1)
flashcards Flashcard (104)
studied byStudied by 41 people
367 days ago
5.0(1)
flashcards Flashcard (45)
studied byStudied by 9 people
700 days ago
5.0(1)
flashcards Flashcard (119)
studied byStudied by 19 people
21 minutes ago
5.0(1)
robot