-3

So I already read what parsing is in the threads here, but wouldnt this be autoboxing or unboxing because it goes from an int to an Integer? This is the sentence

When an integer is added to an array list declared as ArrayList<Integer>, Java performs what?

zapl
  • 63,179
  • 10
  • 123
  • 154
piper
  • 23

1 Answers1

1

The automatic conversion happening here:

ArrayList<Integer> list = ...
int value = 42;
list.add(value);

is called "autoboxing" (or "boxing conversion"): https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html

int value2 = list.get(0);

would be "unboxing" because the Integer from the lists is converted to an int.

Parsing happens only when you read something out of text, like Integer.parseInt("42").

zapl
  • 63,179
  • 10
  • 123
  • 154