Misc Unit 2 Flashcards

(3 cards)

1
Q

Integer.parseInt(s1)

A

converts a string like “10” to an Integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ZonedTime.parse(str)

A

converts a string to ZonedDateTime
“yyyy-mm-ddThh:mm:ss+Z” (Z=offset, aka +1:00)
see baeldung.com/java-format-zoned-datetime-string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
difference between (using BigDecimal):
1. return balance.add(amount);
2. balance = balance.add(amount);
    return balance;
A
  1. just adds them and returns sum, doesn’t change balance

2. adds them and replaces balance with sum, then returns new balance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly