Free Online Flashcard Deck

Java Foundations and Program Design Free Online FlashCards

Study Java Foundations and Program Design with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is the productive programming cycle?

Back

A reliable cycle is to understand the problem, plan an algorithm, implement it, test it, debug and improve it, and explain why it works.

02
Front

Where does a Java application begin execution?

Back

Execution begins in the `main` method: `public static void main(String[] args)` in a Java application.

03
Front

How should a public Java class be named on disk?

Back

Normally, a public class named `Greeting` must be saved in a file named `Greeting.java`.

04
Front

What is the difference between declaration and assignment?

Back

A declaration gives a variable its type and name; an assignment stores a value in it. For example, `int score;` declares, while `score = 95;` assigns.

05
Front

Which Java types fit whole numbers, decimals, logic, characters, and text?

Back

Use `int` for whole numbers, `double` for decimals, `boolean` for logical values, `char` for one character, and `String` for text.

06
Front

What value does `8 + 4 * 2` produce?

Back

`16`. Multiplication is evaluated before addition, so `4 * 2` is calculated before `8 + 8`.

07
Front

How do integer division and remainder differ in Java?

Back

With two `int` operands, `/` performs integer division and discards the fractional part; `%` returns the remainder. Thus, `7 / 2` is `3` and `7 % 2` is `1`.

08
Front

What is `(int) 9.99`?

Back

`9`. Casting `9.99` to `int` removes the fractional portion; it does not round the value.

09
Front

What does `"Average: " + (5 + 10) / 2.0` produce?

Back

`Average: 7.5`. Parentheses make Java add `5 + 10` before dividing by `2.0`, then concatenate the result with the label.

10
Front

How do `print` and `println` differ?

Back

`print` displays text without moving to a new line; `println` displays text and then moves to the next line.

11
Front

Why can `nextInt()` followed by `nextLine()` be surprising?

Back

`nextInt()` reads an integer token, while `nextLine()` reads the rest of the current line. After `nextInt()`, an extra `nextLine()` may be needed to consume the remaining line break.

12
Front

What are the three stages of a basic Java program?

Back

Read the data, process it with expressions and assignments, then display the result. This is the input–process–output pattern.