Module 2

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 20

flashcard set

Earn XP

Description and Tags

Intro to Java

21 Terms

1

What is a string literal in Java?

A string of characters represented by enclosing it in double quotes.

New cards
2

What method is used to print a character string to the console in Java?

The println method.

New cards
3

How does the print method differ from the println method?

The print method does not advance to the next line after printing.

New cards
4

What operator is used for string concatenation in Java?

The + operator.

New cards
5

What are some examples of Java escape sequences?

\b (backspace), \t (tab), \n (newline), " (double quote).

New cards
6

What is a variable in Java?

A name for a location in memory that can hold a value.

New cards
7

What does the assignment operator do in Java?

It changes the value of a variable.

New cards
8

What keyword is used to declare a constant in Java?

The final modifier.

New cards
9

What are the eight primitive data types in Java?

byte, short, int, long, float, double, char, boolean.

New cards
10

What is the difference between widening and narrowing conversions?

Widening conversions go from a smaller to a larger data type, while narrowing conversions go from a larger to a smaller type and can lose information.

New cards
11

What class in Java is used for reading user input?

The Scanner class.

New cards
12

What does the nextLine method of the Scanner class do?

It reads all input until the end of the line as a character string.

New cards
13

What is the purpose of the conversion operators in Java?

To convert data from one type to another.

New cards
14

How are arithmetic expressions evaluated in terms of operator precedence?

Multiplication, division, and remainder are evaluated before addition and subtraction.

New cards
15

What happens if you use the / operator with two integers in Java?

The result will be an integer with the fractional part discarded.

New cards
16

How can you avoid ambiguity in operator precedence in an expression?

By using parentheses to explicitly define the order of evaluation.

New cards
17

What is the result of using the increment operator on a variable?

It adds one to the variable's current value.

New cards
18

What is the significance of a boolean value in Java?

It represents a true or false condition.

New cards
19

What does the Scanner class require to be imported to use it in a program?

The java.util class library.

New cards
20

How does the initialization of a variable work in Java?

A variable can be given an initial value at the time of declaration.

New cards
21

When is the result of an expression in Java evaluated?

The expression on the right side of an assignment operator is evaluated before storing the result in the variable on the left.

New cards

Explore top notes

note Note
studied byStudied by 13 people
906 days ago
5.0(1)
note Note
studied byStudied by 5 people
724 days ago
5.0(1)
note Note
studied byStudied by 1 person
37 days ago
5.0(1)
note Note
studied byStudied by 6 people
815 days ago
5.0(1)
note Note
studied byStudied by 10 people
812 days ago
5.0(1)
note Note
studied byStudied by 17 people
651 days ago
4.7(3)
note Note
studied byStudied by 49 people
808 days ago
5.0(1)
note Note
studied byStudied by 3 people
7 days ago
5.0(1)

Explore top flashcards

flashcards Flashcard (41)
studied byStudied by 65 people
268 days ago
5.0(1)
flashcards Flashcard (59)
studied byStudied by 12 people
279 days ago
5.0(1)
flashcards Flashcard (82)
studied byStudied by 5 people
237 days ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 1 person
699 days ago
5.0(1)
flashcards Flashcard (28)
studied byStudied by 4 people
534 days ago
5.0(1)
flashcards Flashcard (28)
studied byStudied by 98 people
307 days ago
5.0(1)
flashcards Flashcard (36)
studied byStudied by 10 people
516 days ago
5.0(1)
flashcards Flashcard (57)
studied byStudied by 6 people
13 minutes ago
5.0(2)
robot