Misc Unit 2 Flashcards
(3 cards)
1
Q
Integer.parseInt(s1)
A
converts a string like “10” to an Integer
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
3
Q
difference between (using BigDecimal): 1. return balance.add(amount); 2. balance = balance.add(amount); return balance;
A
- just adds them and returns sum, doesn’t change balance
2. adds them and replaces balance with sum, then returns new balance