Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Wrapper Types and Autoboxing

Front

How would you explain the autoboxing trap in `Integer quantity = null; int count = quantity;` in an interview?

Java will unbox `null` and throw a `NullPointerException`. Wrapper-to-primitive conversion looks small in code, but it still changes…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

How would you explain a common mistake when assigning values to variables in an interview?

Using '=' for comparison instead of '=='. Frame the concept in practical terms so you can explain it…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

What are the consequences of poor variable naming?

Poor naming leads to confusion and harder maintenance. Descriptive variable names help developers understand the code quickly. In…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

How do you decide between 'double' and 'BigDecimal' for product pricing?

'BigDecimal' offers better precision for financial calculations. While 'double' is suitable for general calculations, it may cause precision…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

Why is 'int' often used for product stock quantities?

'int' is efficient and sufficient for small to medium inventories. In Java, the 'int' type is commonly used…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

What mistake occurs when mixing data types in assignments?

Type mismatch errors. Frame the concept in practical terms so you can explain it during interview discussion. Assigning…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

How do you declare an integer variable for stock quantity?

Use int for stock quantities. Frame the concept in practical terms so you can explain it during interview…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

Why use descriptive variable names like productPrice?

Improves understanding and maintenance. Frame the concept in practical terms so you can explain it during interview discussion.…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

What are the tradeoffs of using double for currency?

Potential precision issues. Frame the concept in practical terms so you can explain it during interview discussion. The…

View Card →
Flashcard Study

Java: Variables and Data Types

Front

How do you declare a variable for a product SKU?

Use String for alphanumeric identifiers. Frame the concept in practical terms so you can explain it during interview…

View Card →