Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at Test.print(Test.java:11)
	at Test.main(Test.java:14)

From the information from this diagnostic the error can be quickly resolved by replacing addToList(1) with addToList("1").

Noncompliant Code Example

...