String s = "42";
int n = Integer.parseInt(s);
System.out.println(n + 1);What is printed?
- A
421
- B
42
- C
Error
- Dcheck_circle
43
Explanation
Integer.parseInt converts the string "42" to the int 42; adding 1 gives 43.
AP Computer Science A· difficulty 3/5
String s = "42";
int n = Integer.parseInt(s);
System.out.println(n + 1);What is printed?
421
42
Error
43
Explanation
Integer.parseInt converts the string "42" to the int 42; adding 1 gives 43.
Want 10 more like this — adaptive to your weak spots?