Memorization is not enough. Go through the practice exams, mock exams, etc., and make sure you know why an answer is right and others are wrong. If you have a
Java IDE, like eclipse, it's easy to enter the code and experiment with various things to see what happens if you change things around. Can and should do that with a text editor and the javac command if don't have an IDE. Especially on questions where the answer is "compilation fails", fix the problem and run the code to see what it does.
Having experience at writing and debugging code definitely helps to pass the exam. The more you code and try the better you'll get.