I was going through the Sybex book for the OCAJP preparation and came across below code. It says the code does not compile because - ""We imported the asList method. However, we did not import the Arrays class anywhere. This makes it okay to write asList(“one”); but not Arrays.asList(“one”);"" But when I tested it I was able to compile it. Is there something that am missing?
Yea here you get CT Error because you have imported the static member "asList" of Arrays class ok. But in your code you are using "Arrays.asList" so here you are using "Arrays.asList", but you haven't imported the Arrays class of util package, that's why error.
During the Preparation of Your Certification Examination NEVER EVER GIVE UP.