nemo zou

Ranch Hand
+ Follow
since Apr 25, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nemo zou

Why the output of the following code is so strange? I am confused...


The output is

the last two lines make the order hard to understand.
Thank you for your experience! Congratulations!
8 years ago

Hi,
Today I took the ocajp7 exam and passed it with 88%. I'm happy to share my experience with you guys and hope it would be helpful for some of you.

Learning materials: K&B, Mala Gupta, Enthuware, coderanch


Mock test score:
1:67%
2:67%
3:80%
4:76%
5:77%
6:80%
Last:78%

First, I would say Enthuware is a pretty good mock test software for preparation of the exam. Although it's indeed a little more difficult than the real exam, I always believe that overprepared is much better than underprepared. I definitely recommend it to other test takers since $10 for 500 questions is a very cheap price, especially considering you have paid ~$250 for the test and you don't really want to take a second time.

I learned Java from System.out.println("hello world!"); in the beginning of March 2015. Before that, I have 4 years experience in Matlab and 1 year experience in Python. I would say this ojacp test is more like a "syntax" test rather than programming test. In other words, you do not need some strange code styles in real programming as they showed in the exam, or your colleagues won't understand your code and your boss would fire you. I believe K&B book states this point of view at the beginning of it.

As you are reading this, I would thank coderanch and especially Roel De Nijs for his detailed explanations on my previous questions. Any question about the exam is fine to be asked and you should realize that almost all questions you got, during the preparation, have been mentioned and solved by previous people. Therefore, Reol often gives you an old thread link as the explanation for your question. Please remember that don't be too paranoid when you are preparing the exam and, especially, taking the exam. You may find some topic in this forum and Enthuware is too tricky(e.g. Rules for constructor throw exceptions, difference between while(false) and if(false), overload methods with different primitive types and wrapped types arguments and their precedence when invoked......) I'm not saying they are not important and you can ignore it, what I want to say is, according to previous test takes' experience and my experience, the real exam would NOT be so tricky and with many traps. It's not worthy of spending large amount of time in these difficult topics especially when your preparation time is limited. I'm not a perfectionist and I hope you are not neither.

Typically, I can finish my Enthuware mock tests in 80 mins and submit it directly without reviewing. However, in the real exam, I checked every question really carefully in case of any "catch" and it took me about 100 mins to finished all of questions. I also submitted my test directly without doing any more checking since I believe I can obtain 63% at least for passing the exam. The truth is the real exam does not contain as many traps as Enthuware does: all the questions are straightforward even they may contain a long code.

Last thing I want to say about the test is that it was a little pity that I cannot know the mistake I made in the exam after I received the report. Only general comments would be given by Oracle. It is understandable because I believe there is a question bank in the database and Oracle does not want other people know exact questions in this bank, they are private and only can be accessed through real exam.

Good luck every test taker!
8 years ago
I got confused about the this question in Enthuware test 6. I thought the answer is "print nothing" because I remember it is fine to override the main methods. Why an error would be thrown here?
I found thiis topic in webpage
and this code:


the output is


Why there is a jj=4 in the output? Is it because j and jj are both static variables in interface J?

Roel De Nijs wrote:Let's see if you fully have understood the concept of an array. How many objects are created in the following code snippet



i3 contains 10 null objects, length of i3 is 10. Is this correct?

After adding void method1(); to the body of interface, I i2=new I(){}; is an error because The type new I(){} must implement the inherited abstract method. However, I[] i3=new I[10]; is still OK.
I know I cannot instantiate interface and abstract class. But why I can create an interface array without generate compilation error?

I don't think you can add anything to String class since it's a final class.
Please see the picture. I think b is also a right option, am I right?
Another "pass by value and pass by reference" question. I believe there are numerous explanation about this question in the forum...

Henry Wong wrote:

nemo zou wrote:Why the following two snippets output 3 and 5, respectively?



Can you tell us what you expected the results to be? And why?

Henry



I thought the first one is a compilation error since it defines two int a in the same class. The second output is 3 because static{} always runs first in a class...
Why the following two snippets output 3 and 5, respectively?

output:3


output:5
Thanks! I will just try to remember several examples and hope the test won't go so detailed on this topic

Henry Wong wrote:
Well, technically, all three have unreachable code, and all three should not compile. However, the Java specification relaxes the unreachable code requirements for the "if" condition; this is done to allow you to conditionally compile (which is common for debugging / testing code). This is why the first case works, when obviously, it contains unreachable code.

Henry



Does the dead code/unreachable code compilation error only happen when you have code after break/continue in for/while loops? How about switch-case or other situations? Thanks~