Public Deck

AP Computer Science A - 50 Java Concepts

Master AP Computer Science A with 50 flashcards covering Java fundamentals, OOP, arrays, recursion, and algorithms.

AnyFlashcards50 cards

Preview

Front

What is the result of int x = 5 / 2; in Java?

Back

2 Integer division truncates the decimal; 5 / 2 is 2, not 2.5.

Front

How do you compare two String objects for equality in Java?

Back

.equals() method if (str1.equals(str2)) checks content; == checks if they are the same memory reference.

Front

What is the value of Integer.MAX_VALUE + 1?

Back

Integer.MIN_VALUE This is known as integer overflow, wrapping around to the minimum possible value.

Front

What does String.substring(2, 5) return for the string "Computer"?

Back

"mpu" Includes index 2 ('m') up to but NOT including index 5 ('t').

Front

What is the result of (double) 1 / 4?

Back

0.25 Casting one operand to double forces floating-point division.

Front

Is a String object mutable or immutable?

Back

Immutable Once created, a String's value cannot be changed; methods like toUpperCase() return a new String.

Front

What is the result of "1" + 2 + 3?

Back

"123" String concatenation occurs from left to right; "1" + 2 becomes "12", then "12" + 3.

Front

What is the purpose of the final keyword when declaring a variable?

Back

To create a constant final int X = 10; prevents the value of X from being reassigned.

Front

What is 'short-circuit evaluation' in the context of &&?

Back

Skipping the second operand if the first is false if (false && 5/0 == 0) will not throw an error because the second part is never evaluated.

Front

According to De Morgan's Laws, !(A && B) is equivalent to what?

Back

!A || !B Negate both terms and flip the operator from AND to OR.

+ 40 more cards

Related Flashcard Decks

Ready to study?

Sign up for free to copy this deck and start learning with spaced repetition.

Get started for free