I am practicing to write the Java method in repl.it (Auto-Graded Course (AP CS A) ) but anytime I get the error. Thank you for replies.
Instructions from your teacher:
Failed tests: ./UnitTests.java:11: error: reference to assertEquals is ambiguous
The requirement here is a bit unclear.
Returns: an integer
In Java, 4 types can be used to stored integers -
Long. Which type does the question actually want you to use?
Judging from the fact that the return value is
2, without a
L suffix, we can guess that
Long aren't what it is looking for.
Now, do we use
Obviously, since you tried
Integer and it failed the test, it's gotta be
Also, this is kind of a "cultural" (can't think of a better word) thing, where if you ask a Java programmer to create an integer variable, they will almost definitely use
int instead of
The use of
Integer is far less frequent than that of
int. For me, I only use it in generic type parameters, where
int cannot be used.