professor-curious-logo
professor-curious-logo
  1. AP Computer Science A
FlashcardFlashcard
Study GuideStudy GuideQuestion BankQuestion BankGlossaryGlossary

What are the differences between 'int' and 'double' data types in Java?

int: Stores whole numbers | double: Stores decimal numbers.

Flip to see [answer/question]
Flip to see [answer/question]
Revise later
SpaceTo flip
If confident

All Flashcards

What are the differences between 'int' and 'double' data types in Java?

int: Stores whole numbers | double: Stores decimal numbers.

What are the differences between integer division and double division?

Integer division: truncates the decimal part | Double division: gives a decimal result.

What are the differences between age++ and age += 1?

age++: post-increment operator, increments after the current operation | age += 1: adds 1 to age.

What is a compiler?

A program that translates high-level code into machine code.

What is a class in Java?

A blueprint for creating objects.

What is a string literal?

An instance of the String class, representing a sequence of characters.

What is a primitive data type?

A basic data type that stores data directly in memory.

What is a variable?

A container for storing data values.

What is casting?

Changing the data type of a value.

What is the assignment operator?

The '=' symbol, used to assign a value to a variable.

What is a boolean?

A primitive data type with a value of either 'true' or 'false'.

What is the main method?

The entry point of a Java program.

What is the modulo operator?

The '%' symbol, which returns the remainder of a division.

What is the function of the 'void' keyword in a method declaration?

It indicates that the method does not return a value.

What is the difference between System.out.print() and System.out.println()?

println() adds a new line after printing, while print() does not.

Why is Java considered a high-level language?

Because it is more human-readable and further removed from machine code.

What is the purpose of the Scanner class?

To obtain user input from the console.

Why should reserved words be avoided when naming variables?

Because they have predefined meanings in Java and cannot be used as variable names.

What happens during integer division?

The decimal part of the result is truncated.

What does the 'final' keyword do when declaring a variable?

It makes the variable constant, meaning its value cannot be changed after initialization.

Why is casting necessary?

To convert a value from one data type to another, especially when precision might be lost.

What is the significance of descriptive variable names?

They improve code readability and understanding.

What is the difference between declaration and initialization of a variable?

Declaration introduces the variable and its type; initialization assigns it a value.