Neha Agnihotri

Ranch Hand
+ Follow
since Jun 18, 2019
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Neha Agnihotri

Oh yes! Many thanks to both of you.
4 years ago

Can anyone please explain why with == operator in line 9 prints false whereas in line 10 prints true.
4 years ago
Many thanks for the explanation. It's much clear now.

PS: I am really amazed how quickly I get answers/explanation on this forum. A big Thank You to all of you!

In the above code, you get a compilation error on line 5 saying comma is expected instead of semicolon.
However, I was expecting the error on line 6 as I was modifying a final variable from a parent class.  While I can see, if I change the code to :

There is no compilation error. Makes sense!
But the line number of the compilation error is confusing to me in the sense such kind of questions are asked in OCAJP where we are expected to know the line number where the compilation error comes.

Do you know any other example similar to this one? Thanks!

Stephan van Hulst wrote:Static initializers are run in the order they are encountered in the code. In your second code snippet, y = 10 comes after y = 5, so at the end of class initialization, y == 10.

Thanks for your reply Sir. Does it mean line 8 in the second code snippet gets executed twice by the parser?
Please consider following code :

Initially I thought the answer would be compiler error as the variable was referenced before it was declared but it prints 5 as variable y is a static variable.
Now consider following code where static initialiser block is deliberately placed on top :

Now the output is 10.
Can anyone please explain me why it prints 10 instead of 5 as the static initialiser would be called after the static variable was declared and initialised.

Brecht Geeraerts wrote:The advice that I (as a beginning programmer) was given by my more experienced colleagues was that if you score > 80% on two Enthuware tests, you can be reasonably confident that you will also pass the real OCA exam. Be mindful, this is not the outcome of solid scientific studies.  

I have no programming background whatsoever and a couple of months ago, I started learning (java) programming hoping to one day get a job as a developer. Even though people warned me, I found it frustrating to prepare for the OCA exam. It is indeed quite tough. But if you are really motivated, you'll get there!  

How I went about it: I studied and took an Enthuware exam, then I went back to my books and studied again. With every iteration, I felt that I mastered more details and exceptions (no pun intended). It was only when I reached mock tests 4 or 5 that I  was able to pass the arbitrary threshold of 80% that I set for myself. This gave me the confidence boost I needed. I found the real exam slightly less difficult than the mock exams but that is a very subjective feeling and don't take it for granted.

Also, if you have any questions, search the forum. Lots of people here are preparing for these certification exams. Chances are that your question has been asked before. If that is not yet the case, post your question and I'm sure you will get a quality response very quickly.  

Thanks a ton for your detailed reply. I appreciate

sohail hussain wrote:Neha I understood your problem, some time we need to use our commen sence, it is good your are sharing your thoughts
Think about khaleed mughal book for ocajp-8

Thanks for your reply Sohail. I think you meant "common sense" ;)
On a lighter note, I am sure you must be knowing, common sense is not so common in common people.

Mikhail Volkov wrote:Neha, be attentive! My scores on Whizlabs were 80-91%. I passed all tests. I need only 2 hours to past any test on Whizlabs and get good result.  So when I went to OCA exam I was sure of myself. But I failed the exam!!! My scores were only 60%! Can you imagine? And it was 2 weeks ago. It was horrible for me.
You should... No, you must try to pass Enthuware Tests. All tests!!! On exam there are too many questions where is "big code". I think they are not very hard, but you have only 150 minutes.
Good luck! And please, tell you history after the examination...

Thanks Mikhail for your honest advice. I appreciate!
Sure, I will tell how it went.

Jeanne Boyarsky wrote:Neha,
You definitely don't have to know those things. (I realize I'm the same person who wrote that in the book, but wanted to take a moment to mention that it is still true!) In fact, it's even true on the Java 11 exam.

Thanks Jeanne. You have been very helpful.
That's such a big relief. Many thanks for your reply.
Recently, I gave practice test III on Whizlabs and there were several questions on Octal-to-decimal conversion, native keyword,  etc. (fortunately I answered them correctly).
However Jeanne and Scott's book OCA Study Guide (page 22) claims that we don't need to know conversion between number systems in exam. Also page 168 says we don't have to know native keyword for OCA.

While I understand, it's good to know the both of these, can anyone please authenticate what should be done for the real exam?
Should I also purchase Enthuware practice test? I am currectly scoring an average of 85% on Whizlabs, so I am now getting a bit concerned as I will be appearing for the actual test in 10 days.
I see some practice tests asking to tell if so-and-so method was newly introduced in Java SE8. Do I need to remember all the methods/features that were introduced in Java SE8? Should I expect such kind of questions in real exam?
For example,
Is split() method newly added in String class in Java SE8?

Thanks for the clarification, Sir.

I tried doing this, and now it makes sense why toString() shouldn't work in the above post.

Can anyone please explain why toString(int arr[]) static method of Arrays class doesn't work with static import.Thanks!