AP CSA Unit 2: Objects

4.5(8)
studied byStudied by 406 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

object

a data type that is created in Java

2
New cards

Math class

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

3
New cards

static method

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

can be called without class’s instance or object

4
New cards

Math.abs(x)

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

5
New cards

Math.pow(x,y)

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

6
New cards

Math.PI

stores the value for pi: 3.141592653…

7
New cards

charAt(int x)

returns the char at the given index of ‘x’

8
New cards

contains(String s)

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

9
New cards

endsWith(String s)

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

10
New cards

equals(String s)

returns true when the two strings are equal, false otherwise

11
New cards

equalsIgnoreCase(String s)

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

12
New cards
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

13
New cards
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

14
New cards
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

15
New cards
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

16
New cards
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

Explore top flashcards

HIS 102 Midterm
Updated 912d ago
flashcards Flashcards (108)
LGBTQ Vocabulary
Updated 1057d ago
flashcards Flashcards (53)
3.4 (woordenlijst)
Updated 1001d ago
flashcards Flashcards (20)
biology
Updated 547d ago
flashcards Flashcards (30)
Bio Lab Exam 1
Updated 57m ago
flashcards Flashcards (81)
HIS 102 Midterm
Updated 912d ago
flashcards Flashcards (108)
LGBTQ Vocabulary
Updated 1057d ago
flashcards Flashcards (53)
3.4 (woordenlijst)
Updated 1001d ago
flashcards Flashcards (20)
biology
Updated 547d ago
flashcards Flashcards (30)
Bio Lab Exam 1
Updated 57m ago
flashcards Flashcards (81)